JavaScript - Only Works In Ie
Can anyone see why this code only shows the image in IE?
I realise I could write out the tags in full, but that's not the reason, is it... Code: <script> if (screen.width <= 1024) { document.write("<div style=\"position: absolute; width: 122px; height: 86px; z-index: 1; left: 0px; top: -1px\" id=\"layer2\">"); } if (screen.width == 1920) { document.write("<div style=\"position: absolute; width: 122px; height: 86px; z-index: 1; left: 400px; top: -1px\" id=\"layer2\">"); } else { document.write("<div style=\"position: absolute; width: 122px; height: 86px; z-index: 1; left: 100px; top: -1px\" id=\"layer2\">"); } document.write("<img border=\"0\" src=\"assets/images/flourish4.gif\" width=\"124\" height=\"125\"></div>"); </script> Thanks Similar TutorialsSo I have this code listed below: Code: <script type="text/javascript"> if (!window.console) { window.console = { log: function(obj){ /* define own logging function here, or leave empty */ } }; } region=[//2 dimensional array containing area codes and region pairs ["201","nj"], ["202","dc"], ] function getRegion(code){ index=0; while(true){ console.log(index); if(region[index][0]==code){ return(region[index][1]); } index++; if(index>=region.length){ return(undefined); } } } function getLocation(number){ out=document.getElementById('output'); var answer; if(number.length<3){ return(void(0)); } else{ var code=number.substring(0,3); answer=getRegion(code) if(answer==undefined){ out.innerText="unknown area code"; } else{ out.innerText=answer; } } } </script> ... <form> <input type="text" id="number" onkeyup="getLocation(this.value)"> </form> <div id="output"> </div> It works perfectly fine in IE but as soon as I load it in FF it does nothing. Is there something that I am missing? Any help would be appreciated. Something in this function causes it to not work in IE7, but work fine in FF3.5 and IE8. Any idea what it could be? I am creating a list of input boxes in a form. Code: function createOneList() { var formElement = document.getElementById('theGrid'); if (formElement && formElement.parentNode && formElement.parentNode.removeChild) { formElement.parentNode.removeChild(formElement); } //Removes the previous 'theGrid' if you choose another calculation or graph var numberOfData = document.forms[0].datacount.value; //Option number of data points var form = document.createElement("form"); // create a form form.setAttribute("name", "theGrid"); // give form a name form.setAttribute("id", "theGrid"); // give form an id //form.setAttribute("action", "./calculate.php"); // give form an action form.setAttribute("method", "GET"); // give form a method document.body.appendChild(form); // append form to body for (var i=1; i<=numberOfData; i++) { var input = document.createElement("input"); // create an input element input.setAttribute("name", "data[]"); // give input a name input.setAttribute("type", "text"); // make it a text input input.setAttribute("value", ""); // give input a value form.appendChild(input); // append input to form form.appendChild(document.createElement("br")); // create a br tag } form.appendChild(document.createElement("br")); // create a br tag var input = document.createElement("input"); // create an input element input.setAttribute("type", "button"); // make it a submit button input.setAttribute("value", "Calculate"); // give input a value input.onclick = new Function("Display()"); // if Caluclate button is clicked, Display() function is run form.appendChild(input); // append input to form document.getElementsByTagName("body")[0].appendChild(form); // append form to body element } I have three java functions running on a form and everything works great, but I cannot figure out why Firefox isn't working... This is very frustrating... Any suggestions would be greatly appreciated. Thanks! Link to form Hi I am new to programming have tried to write a simple HTML page and servlet. Using tomcat. Added a javascript validation function. However when I type wrong it works the first time, displays alert and returns to entry form. on second attempt type in wrong again, expected to see alert and return to entry form but it submits. I am new to programmng and could do with some help can not find any clue, answer to this problem. Have checked javascript is ticked in Firefox 5.0. Set up is I have a HTML page with one javascript check function at present for test development. It is linked to a servlet in tomcat. Problem is when I enter wrong the first time, get alert message and it returns to the HTML orginal page. However if I click on entry field and enter wrong again. It submits the form, does not give an alert or return to the orginal form? Has any one got a solution or is this how validation should work. Code is: Code: <HTML><head><title>Creation of POs</title> <H1>Purchase Order</h1> <script type="text/javaScript"> function check() { check = document.forms[0].SLine1.value; if(check=="wrong"){ alert("enter correct info"); return false; } else { return true; } } </script></head><body bgcolour="yellow"> <form method="GET" action="Distest_session30a_vs1" onSubmit="return check()"> various inputboxes and messages <table> <tr><td><input type="text" name="SLine1"></td></tr> various other lines of inputs boxes </table> <Input type="submit" value="Send now"> </form></body></html> Thanks in advance for any help people can give spent a lot of time on this already and can think of nothing else to try to resolve. Using firefox 5.0, check and javascript is enabled? Go figure huh??? Anyways I have a script a co-worker wrote and it works in FF and Chrome but IE will not work. Get's a 'activeTab' is null or not an object error, I checked for commas and fixed a semi-colon that was missing in two spots but not change in IE. Anyone willing to throw me a bone? code below: Code: <table class="tan-header rounded-box" style="padding:0px;border:0px;width:560px" cellspacing=0 cellpadding=0> <tr class="headerrow"> <td class="main"> <div style="font-weight:bold;padding-top:4px;"> <span ID="Sample Pricing _show" class="arrow-box" style="display:none;"><a href="javascript:Expand('Sample Pricing ');"> <img alt="Click arrow to expand this panel" src="images/right.png" border=0 align="absmiddle"></a></span> <span ID="Sample Pricing _hide" class="arrow-box"><a href="javascript:Contract('Sample Pricing ');"> <img alt="Click arrow to collapse this panel" src="images/down.png" border=0 align="absmiddle"></a></span> Sample Pricing </div> </td> <td class="end"></td> </tr> <tr class="contentrow"> <td class="main"> <div id="Sample Pricing "> <p><em>Based on the following spec's: </em></p> <ul> <li>8.5 x 11 </li> <li>70# high quality opaque paper</li> </ul> <p align="center"> </p> <div align="center"> <table id="pricing_table_tabs"> <th> <td id="option1" class="active_pricing_table_tab">Option 1</td> <td id="option2" class="">Option 2</td> </th> </table> <table width="494" border="1" id="pricing_table1" class="active_table"> <tr> <th width="80" height="30" scope="col">Quantity</th> <th width="95" scope="col">1 Color </th> <th width="95" scope="col">2 Colors</th> <th width="95" scope="col">4 Colors</th> <th width="95" scope="col"> </th> </tr> <tr> <td><div align="center">250</div></td> <td><div align="center">$197.69</div></td> <td><div align="center">$221.58</div></td> <td><div align="center">$420.26</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">500</div></td> <td><div align="center">$210.78</div></td> <td><div align="center">$233.79</div></td> <td><div align="center">$434.75</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">1000</div></td> <td><div align="center">$238.92</div></td> <td><div align="center">$262.30</div></td> <td><div align="center">$446.18</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">2000</div></td> <td><div align="center">$298.84</div></td> <td><div align="center">$316.78</div></td> <td><div align="center">$481.68</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">2500</div></td> <td><div align="center">$328.26</div></td> <td><div align="center">$345.55</div></td> <td><div align="center">$499.10</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">3000</div></td> <td><div align="center">$358.50</div></td> <td><div align="center">$373.05</div></td> <td><div align="center">$513.08</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">4000</div></td> <td><div align="center">$416.68</div></td> <td><div align="center">$430.29</div></td> <td><div align="center">$548.58</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">5000</div></td> <td><div align="center">$476.63</div></td> <td><div align="center">$485.45</div></td> <td><div align="center">$585.15</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">10000</div></td> <td><div align="center">$713.26</div></td> <td><div align="center">$758.94</div></td> <td><div align="center">$751.91</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">15000</div></td> <td><div align="center">$879.51</div></td> <td><div align="center">$925.01</div></td> <td><div align="center">$919.47</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">20000</div></td> <td><div align="center">$1041.92</div></td> <td><div align="center">$1092.30</div></td> <td><div align="center">$1085.25</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> </table> <table width="494" border="1" id="pricing_table2" class="inactive_table"> <tr> <th width="80" height="30" scope="col">Quantity</th> <th width="95" scope="col">1 Color </th> <th width="95" scope="col">2 Colors</th> <th width="95" scope="col">4 Colors</th> <th width="95" scope="col"> </th> </tr> <tr> <td><div align="center">250</div></td> <td><div align="center">$1</div></td> <td><div align="center">$2</div></td> <td><div align="center">$4</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">500</div></td> <td><div align="center">$2</div></td> <td><div align="center">$2</div></td> <td><div align="center">$4</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">1000</div></td> <td><div align="center">$238.92</div></td> <td><div align="center">$262.30</div></td> <td><div align="center">$446.18</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">2000</div></td> <td><div align="center">$298.84</div></td> <td><div align="center">$316.78</div></td> <td><div align="center">$481.68</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">2500</div></td> <td><div align="center">$328.26</div></td> <td><div align="center">$345.55</div></td> <td><div align="center">$499.10</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">3000</div></td> <td><div align="center">$358.50</div></td> <td><div align="center">$373.05</div></td> <td><div align="center">$513.08</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">4000</div></td> <td><div align="center">$416.68</div></td> <td><div align="center">$430.29</div></td> <td><div align="center">$548.58</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">5000</div></td> <td><div align="center">$476.63</div></td> <td><div align="center">$485.45</div></td> <td><div align="center">$585.15</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">10000</div></td> <td><div align="center">$713.26</div></td> <td><div align="center">$758.94</div></td> <td><div align="center">$751.91</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">15000</div></td> <td><div align="center">$879.51</div></td> <td><div align="center">$925.01</div></td> <td><div align="center">$919.47</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> <tr> <td><div align="center">20000</div></td> <td><div align="center">$1041.92</div></td> <td><div align="center">$1092.30</div></td> <td><div align="center">$1085.25</div></td> <td><div align="center"><a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Place_An_Order/form.mdl&FORM_Form_ID=15221">buy now</a></div></td> </tr> </table> </div> <p align="center"> </p> <p align="center"><strong>Can't find what you are looking for - <a href="https://www.secured-site6.com/printcenter/index.iml?mdl=Request_Estimate/form.mdl&FORM_Form_ID=42195">click here</a> to request a custom quote. </strong></p> </body> </html> </div> <div ID="Sample Pricing _instr" class="detail" style="display:none"> (Click the triangle above to expand this panel.) </div> </td> <td class="end"></td> </tr> <tr class="footerrow"> <td class="main"></td> <td class="end"></td> </tr> </table> <br> <style> #pricing_table_tabs{ border-collapse: collapse; } #pricing_table_tabs td{ border: 2px solid #ccc; padding: 5px; font-size:1.2em; font-weight:bold; } #pricing_table_tabs td:hover{ cursor: pointer; } .active_pricing_table_tab{ background-color: black; border-style: inset; color:white; } .active_table{display:block;} .inactive_table{display:none;} </style> <script language="javascript" type="text/javascript"> var activeTab = document.getElementById("option1"); var activePricingTable = document.getElementById("pricing_table1"); function activateTab() { if(activeTab) { activeTab.className = ""; activeTab = document.getElementById(this.id); activeTab.className = "active_pricing_table_tab"; activatePricingTable(activeTab.id); } else { activeTab = document.getElementById(this.id); activeTab.className = "active_pricing_table_tab"; activatePricingTable(activeTab.id); } } function activatePricingTable(activeTabId) { if(activePricingTable) { activePricingTable.className = "inactive_table"; activePricingTable = document.getElementById("pricing_table" + activeTabId.charAt(activeTabId.length - 1)); activePricingTable.className = "active_table"; } else { activePricingTable = document.getElementById("pricing_table" + activeTabId.charAt(activeTabId.length - 1)); activePricingTable.className = "active_table"; } } for(i=1; i<=2; i++){ if (window.addEventListener){ document.getElementById("option" + i).addEventListener("click", activateTab, false); } else{ document.getElementById("option" + i).attachEvent("onclick", activateTab); } } </script> Hi friends, Im using javascript for my gallery with slideshow, its perfectly working in 3 browsers like safari, Firefox and chrome but not working in IE7. There is an alignment problem + scripting problem, Pls help me friends asap. Thanks. Hi, I'm a JS newbie, but I came up with a (doubtless flawed) script to swap out flash videos according to the selection from an html form. The script works in IE, and used to work for me in FF3, but no longer works for me in FF3.5.2. The code is as follows: Code: <html> <head> <script type="text/javascript"> function changeEp() { var chosen = prepisodes.value; var swapStr = '<embed src="http://c.brightcove.com/services/viewer/federated_f8/1119352258"\n' + 'bgcolor="#FFFFFF"\n' + 'flashVars="videoId=' + chosen + '&playerId=1119352258&viewerSecureGatewayURL=https://console.brightcove.com/services/amfgateway&servicesURL=http://services.brightcove.com/services&cdnURL=http://admin.brightcove.com&domain=embed&autoStart=false&"\n' + 'base="http://admin.brightcove.com" name="flashObj"\n' + 'width="100%" height="509" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true"\n' + 'pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>'; document.getElementById('swapDiv').innerHTML = swapStr; } </script> </head> <body> <div id="swapDiv"> <embed src="http://c.brightcove.com/services/viewer/federated_f8/1119352258" bgcolor="#FFFFFF" flashVars="videoId=6069547001&playerId=1119352258&viewerSecureGatewayURL=https://console.brightcove.com/services/amfgateway&servicesURL=http://services.brightcove.com/services&cdnURL=http://admin.brightcove.com&domain=embed&autoStart=false&" base="http://admin.brightcove.com" name="flashObj" width="100%" height="509" seamlesstabbing="false" type="application/x-shockwave-flash" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> </div> <div> <select name="prepisodes" id="prepisodes" style="background:white;border:red;width:100%;color:red;font-size:100%;font-family:constantia;" onChange="changeEp();"> <option value="6069547001" style="background:gold;">episode 1: arrival</option> <option value="6081338001">episode 2: the chimes of big ben</option> <option value="6081339001" style="background:gold;">episode 3: a b and c</option> <option value="6081340001">episode 4: free for all</option> <option value="6081341001" style="background:gold;">episode 5: the schizoid man</option> <option value="6081342001">episode 6: the general</option> <option value="6081343001" style="background:gold;">episode 7: many happy returns</option> <option value="6081344001">episode 8: dance of the dead</option> <option value="6081346001" style="background:gold;">episode 9: checkmate</option> <option value="6081349001">episode 10: hammer into anvil</option> <option value="6081345001" style="background:gold;">episode 11: it's your funeral</option> <option value="6081348001">episode 12: a change of mind</option> <option value="6081359001" style="background:gold;">episode 13: do not forsake me oh my darling</option> <option value="6081347001">episode 14: living in harmony</option> <option value="6081350001" style="background:gold;">episode 15: the girl who was death</option> <option value="6081351001">episode 16: once upon a time</option> <option value="6081352001" style="background:gold;">episode 17: fall out</option> </select> </div> </body> </html> I used the name attribute, as it allowed the script to work in IE, and the id attribute, as it allowed the script to work in FF (at least before I upgraded). Any assistance with this would be much appreciated. Any ideas on how I can make this work in IE as well?? It is a code that shows a divide on click and then hides the rest at the same time. live code is also at chryscreations.com/ns/boynames.html Javascript: Code: function showstuff(divID) { els=document.getElementsByName('mydiv') for (var i = 0; i < els.length; i++) { els[i].style.visibility="hidden"; els[i].style.display="none"; } document.getElementById(divID).style.visibility="visible"; document.getElementById(divID).style.display="block"; } HTML Code: <head> <script> window.onload=function() { showstuff(''); } </script> </head> <body> <a href="javascript:showstuff('adivide')">A</a> <a href="javascript:showstuff('bdivide')">B</a> <div name="mydiv" id="adivide"></div> <div name="mydiv" id="bdivide"></div> <body> i got this code from this thread http://www.codingforums.com/showthread.php?t=241809(THanks to jmrker) and i was wondering if you could explain how it works(The creating textboxes and the randomization). Edit: SOrry i forgot to include the code Code: <!DOC HTML> <html> <head> <title> Untitled </title> <script type="text/javascript"> // From: http://www.codingforums.com/showthread.php?t=241809 var maxSeats = 341; var rndSeats = 10; function randOrd() { return (Math.round(Math.random())-0.5); } function createDisplay() { var seating = [];; var str = ''; for (var i=0; i<maxSeats; ++i) { seating.push(0); } for (var i=0; i<maxSeats; i++) { str += '<input type="text" size="1" id="s'+i+'" value="'+seating[i]+'">'; if ((i % 33) == 32) { str += '<br>'; } } document.getElementById('auditorium').innerHTML = str; } var sarr = []; function randomize() { for (var i=0; i<maxSeats; i++) { sarr[i] = i; } sarr.sort(randOrd); } var tptr; var ptr = 0; function pauseDisplay() { document.getElementById('s'+sarr[ptr]).value = 'x'; document.getElementById('s'+sarr[ptr]).style.backgroundColor = 'red'; if (ptr < (maxSeats-rndSeats)) { ptr++; tptr = setTimeout("pauseDisplay()",250); } } window.onload = function() { createDisplay(); randomize(); tptr = setTimeout("pauseDisplay()",250); } </script> </head> <body> <div id="auditorium"></div> </body> </html> Hey guys, Working on a large project. Ive created a form that when an anchor is clicked it calls the following javascript. This code executes fine in FF and creates a new select box, input box, and delete anchor. When i attempt this code in IE 8, an error occurs. The error message below and referes to the lines in which i have used the newField array. Code: <script type="text/javascript"> var counter = 0; function moreFields() { var newFields = document.getElementById('rowline').cloneNode(true); var insertHere = document.getElementById('inputgroup'); var newField = newFields.childNodes; counter = document.getElementsByTagName('select').length; newField[2].name = 'item' + counter; counter = document.getElementsByTagName('input').length; newField[5].name = 'amount' + counter; newField[7].style.display = 'block'; insertHere.parentNode.insertBefore(newFields,insertHere); } </script> Error: Object doesn't support this property or method Im guessing this refers to the attempt to use .name/.style . Does anyone know why this is the case or an alternative way to do this? Thanks. Matthew King Hi All I have a content slider, but it only seems to work in FF and not any of the other browsers. I am using Wordpress but its not a plugin This is what I have: page.php Code: <?php if (is_front_page()) { include ("homepage-slider.php"); } ?> homepage-slider.php Code: <!-- Inner content DIVs should always carry "contentdiv" CSS class --> <!-- Pagination DIV should always carry "paginate-SLIDERID" CSS class --> <div id="slider1" class="sliderwrapper"> <div class="contentdiv"> <div class="home-div1"> <div class="home-div-logo"></div> </div> </div> <div class="contentdiv"> <div class="home-div2"> <span></span> </div> </div> <div class="contentdiv"> <div class="home-div3"> <span></span> </div> </div> </div> <div id="paginate-slider1" class="pagination" style="display:none;"> </div> <script type="text/javascript"> featuredcontentslider.init({ id: "slider1", //id of main slider DIV contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"] toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc] nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide. revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover" enablefade: [true, 0.2], //[true/false, fadedegree] autorotate: [true, 4000], //[true/false, pausetime] onChange: function(previndex, curindex){ //event handler fired whenever script changes slide //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc) //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc) } }) </script> There are 2 other external files : contentslider.js contentslider.css Click Here to see site. If someone could help I would really appreciate it, been bugging me big time. Cheers, Jay I have a userscript that helps me move things around on a vB based forum that I moderate. I am using the following to quickly select and submit my selection, however, when it hits the document.vbform.submit(); part of the code the pages just sits there. It does work if the forum ID's I have in place don't line up with any of the forum ID's on the forums but it just will ooad the page and say no such forum exists. So I know submit(); can work..... Code: // INJECT FUNCTION TO PAGE FOR LATER USE window.InjectFunction = function(reg) { if (reg == "na") { var theScr = "" + "function des(id) {" + "\nvar destination = document.getElementsByName('destforumid')[0];" + "\nvar radio = document.getElementsByName('redirect');" + "\nif (id == '39') {" + "\nradio[0].checked = true;" + "\n}" + "\nelse {" + "\nradio[2].checked = true;" + "\n}" + "\nfor ( var i = 0; i < destination.options.length; i++ ) {" + "\nif ( destination.options[i].value == id ) {" + "\ndestination.options[i].selected = true;" + "\nreturn;" + "\n}" + "\n}" + "\ndocument.vbform.submit();" + "\n}" } var scrTag = document.createElement("script") var scrHead = document.getElementsByTagName("head")[0]; scrTag.setAttribute('type', 'text/javascript'); scrTag.appendChild(document.createTextNode(theScr)); scrHead.appendChild(scrTag); } // ADD MENU THAT WILL PASS FORUM IDs AND CALL INJECTED FORUMS window.NewMenu = function(reg) { var divTag = document.createElement("div"); divTag.id = "div1"; divTag.setAttribute("align","left"); divTag.style.margin = "0px auto"; divTag.style.backgroundColor = "#f5edc3"; divTag.style.position = "fixed"; divTag.style.bottom = "0px"; divTag.style.left = "50%"; divTag.style.width = "196px"; divTag.style.marginLeft = "-98px"; divTag.style.height = "auto"; divTag.className ="dynamicDiv"; divTag.zIndex = "1000"; document.body.appendChild(divTag); if (reg == "na") { var dBody = '<div class="newmenu" onClick="des(\'2\');">SELECTION 2 </div>' + '\n<div class="newmenu2" onClick="des(\'43\');">SELECTION 2 </div>' + '\n<div class="newmenu" onClick="des(\'41\');">SELECTION 3 </div>' + '\n<div class="newmenu2" onClick="des(\'15\');">SELECTION 4 </div>' + '\n<div class="newmenu" onClick="des(\'4\');">SELECTION 5 </div>' + '\n<div class="newmenu2" onClick="des(\'3\');">SELECTION 6 </div>' + '\n<div class="newmenu" onClick="des(\'19\');">SELECTION 7 </div>' + '\n<div class="newmenu2" onClick="des(\'39\');">TRASH </div>' ; } divTag.innerHTML = dBody; } var location = window.location.toString(); var region = location.substring((location.indexOf("//") + 2), location.indexOf(".")); var view = location.substring((location.indexOf("board/") + 6), location.indexOf(".php")); if (view == "forumdisplay") { HideMoveClose(); ColorThreads(); } else if (view == "postings") { var destination = document.getElementsByName('destforumid')[0]; if ( destination != null) { ChangeRedirect(); InjectFunction(region); NewMenu(region); ApplyCSS(); window.scrollTo(0,document.body.scrollHeight); } } else if (view == "search") { ColorThreads(); } else { //alert(); } Please note I have edited out a large portion of this code to make the search for the problem a little easier and the code that remains is relevant to the issue. As you can see there are other functions and blah blah but those all work correctly. On the if statements I removed the else if's and else since they are basically just the same thing as the if portion just with a different region code. I have wrapped this whole deal in try {} catch() {} but no errors get thrown. Please any thoughts? I just discovered one of my scripts doesn't work quite right on an older version of Firefox(3.622). It does when I reload the page, but not automatically on initial load Any thoughts on what to change? Here's what I have... Code: <script type="text/javascript" src="author_find.js"></script> <img src=/storage/image.gif onload="javascript:doit();" /> <div id="author"></div> Here is the script it is referencing: Code: function doit() { if($('div').hasClass('single-journal-entry-wrapper')) { var theURL = null; var spans = document.getElementsByTagName("span"); for ( var s = 0; s < spans.length; s++ ) { // searching through spans for the class name: var span = spans[s]; if ( span.className.indexOf("posted-by") >= 0 ) { var useit = span.getElementsByTagName("a")[0]; theURL = useit.href; break; // just the one } } if ( theURL == null ) { // alert("failed!"); } else { var parts = theURL.split('/'); var result = parts[parts.length-1]; if (result == "somebodysname") { var txt=document.getElementById("author"); txt.innerHTML="<table width=100px border=0 cellpadding=0 cellspacing=0 bgcolor=#ffffff><tr><td>content1</td></tr></table>"; } else if (result == "anothername") { var txt=document.getElementById("author"); txt.innerHTML="content2"; } } }else { } } Hi, this is a bit of a long question, but I'm not sure what's relevant, so feel free to ignore the irrelevant bits. I have this function: Code: function searchLocations() { var found = false; var input = document.getElementById('autocomplete').value; var inp = input.toLowerCase(); var count = 0; map.closeInfoWindow(); for (var j = 0; j < gmarkers.length; j++) { gmarkers[j].hide(); elabels[j].hide(); var str=gmarkers[j].myname.toLowerCase(); var patt1=inp; if (str.match(patt1)) { found = true; gmarkers[j].show(); var point = gmarkers[j].getPoint(); bounds.extend(point); elabels[j].show(); count++; var q=j; } } if (count==1) { map.setZoom(15); myclick(q); elabels[q].hide(); } else if (count>1) { centerZoom(); } else { alert("No matches found. Please check your spelling or refine your search."); } } which does the following: - checks for matches in the array vs the input from the text box - shows the matching markers on the map - takes note of where the markers are and increases the bounds area to be displayed (this is the var point = gmarkers[j].getPoint(); bounds.extend(point); bit - keeps count of how many matches were made - if it's one match, zooms the map to 15, shows an infowindow - if it's more than one match, fires centerZoom();, another function that either zooms the map in or out (depending on the bounds) so that the matched markers are displayed. Which is all great, as you can see if you type "par" into the search box top right here. The problem is when you type in the second partial match - say "bl" - then it doesn't just use the 3 points from the match, but all the points from the array, meaning that the map zooms out as if it were going to show every marker, even though it only shows a few. So my question (finally) is how can I make sure that the var point = gmarkers[j].getPoint(); bounds.extend(point); bit only picks up the markers that are currently matched? thanks in advance for any suggestions Basically, i am creating an expandable/collapsible menu. which works fin in FF and chrome, but not in IE. this is the code i can narrow it down to that is not working: Code: window.addEvent('domready', function() { SqueezeBox.initialize({}); $$('a.modal').each(function(el) { el.addEvent('click', function(e) { new Event(eX).stop(); SqueezeBox.fromElement(el); }); }); }); it keeps giving me errors, but when i take it out, it stops. it works in FF just fine and in chrome just fine. but in IE, it loads with errors and then the function is not working. this is the code for the actual placement of the function: Code: echo '<div class="abstract">'; echo '<div class="top">'; echo '<h2 class="gold bold md-2">'; echo wordwrap($row['vp_name'], 50, '<br>'); echo '</h2>'; echo '<span class="md">'; echo 'Hotel: '; echo '</span>'; echo '<strong class="md">'; echo wordwrap($row['vp_hotel'], 50, '<br>'); echo '</strong>'; echo '<br />'; echo '<span class="md">'; echo 'Price Range: '; echo '</span>'; echo '<strong class="md">'; echo $row['vp_price']; echo '</strong>'; echo '<br />'; echo '<p>'; echo 'Details: '; echo '<span class="expand blue">Expand</span> | <span class="collapse blue">Collapse</span>'; echo '</p>'; echo '</div>'; echo '<div style="overflow:hidden;">'; echo '<div class="more-details clear">'; echo '<ul>'; echo '<li>'; echo $row['vp_desc']; echo '</li>'; if(!empty($row['vp_terms'])){ echo '<li>'; echo $row['vp_terms']; echo '</li>'; } if(!empty($row['vp_website'])){ echo '<li>'; echo '<a href="' . $row['vp_website'] . '" title="" rel="nofollow" target="_blank" class="md">Visit Website</a>'; echo '</li>'; } echo '</ul>'; echo '</div>'; echo '</div>'; echo '</div>'; Hi, Please see URL http://backstageweb.net/Salon/indexslides2.htm. (code is below, original source: http://javascript.internet.com/misce...lide-show.html The slide show cross-fade effect in this script works in IE, but not in FF. I know there are better scripts I could use, but I like this one because of its simplicity (doesn't require any accompanying CSS, etc). But I need it to work in all browsers. Is there a simple fix here? Thanks, John Code: <head> <script type="text/JavaScript"> <!-- Original: CodeLifter.com (support@codelifter.com) --> <!-- Web Site: http://www.codelifter.com --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin // Set slideShowSpeed (milliseconds) var slideShowSpeed = 5000; // Duration of crossfade (seconds) var crossFadeDuration = 3; // Specify the image files var Pic = new Array(); // to add more images, just continue // the pattern, adding to the array below Pic[0] = 'images/01.jpg' Pic[1] = 'images/02.jpg' Pic[2] = 'images/03.jpg' Pic[3] = 'images/04.jpg' Pic[4] = 'images/05.jpg' // do not edit anything below this line var t; var j = 0; var p = Pic.length; var preLoad = new Array(); for (i = 0; i < p; i++) { preLoad[i] = new Image(); preLoad[i].src = Pic[i]; } function runSlideShow() { if (document.all) { document.images.SlideShow.style.filter="blendTrans(duration=2)"; document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"; document.images.SlideShow.filters.blendTrans.Apply(); } document.images.SlideShow.src = preLoad[j].src; if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); } j = j + 1; if (j > (p - 1)) j = 0; t = setTimeout('runSlideShow()', slideShowSpeed); } // End --> </script> </head> Code: <body onLoad="runSlideShow()"> Code: <div id="slides"> <img src="images/01.jpg" name='SlideShow' width="380" height="541"> </div> I have been interested in APIs in the last time and i want to know exactly how it works from the server side. so i tried to figure out how the client side API working , first step i took the Google Plus One JS client side code and i tried to figure out how it works , mostly i tried to find how it gets connect to the server side. i couldn't find what this whole code doing , mainly because i focused to find Ajax requests , but there is none of them. this is the api I checked : https://apis.google.com/js/plusone.js now , my questions is simple , i want to know how API connect to the server side , do they use AJAX? what exactly they use to send request to server side ? i need you're help to know more on how api working on Client side , mainly on the connect to the server. so , how it get's done? Hiya, For school we programmed a game in JavaScript. We uploaded it to the school site (http://graphics.cs.wisc.edu/Courses/...spacewars.html) where it works the way it should. (In Firefox; other browsers don't work as well.) However, I'm trying to upload the exact same code to my own website (http://www.tessaverbruggen.nl/Games/...spacewars.html), where for some reason it refuses to run and instead crashes the browser. To me it seems like it's stuck in some sort of while-loop. If I run it locally, it works fine (once again, in Firefox, after changing some settings in Firefox). I program regularly, but I rarely do things web-related. So all the website related stuff was done by others. Which means I have absolutely no idea where to even start debugging. Theoretically it shouldn't be anything in the code as it's the exact same code, and it also runs locally... Could it be some setting on my website/server? If not, what could it possibly be/where should I look? Thanks! Hello Guys, im writing a big page with several different elements in it, and im stuck trying to duplicate a script. first one works "tab b" click each 'icon' and a .png file appears above it to show its selected. "tab c" same script and code seems to only work for first icon, and switch off when clicked on the others. been staring at this for sooooome time now, please can someone see what i have done wrong, as i dont really understand the code im using, im just a beginner. url is http://www.zakscustomcues.com/module...builder2.0.php much appreciated. steve I'm new to HTML and javascript programming, so I apologize if the solution to this is blatantly obvious. I've got expanding text / menus in javascript on my page. These all work in IE with no problems that I can tell. Unfortunately, when I view the page in Firefox, only the first expanding menu is actually a link and works - the rest do not even appear as links and don't work (and the expanded text isn't showing either). You can visit the page at http://www.scienceadvice.ca/uploads/...s/may2010.html Any help would be most appreciated! Thanks! |