JavaScript - Script Failing In Ie
I have this script that works in IE:
Code: var xmlhttpInk; var inkdivID; var inkholdID; function addInkOpt(iside,ivalue) { inkdivID="ink"+iside+ivalue; inkholdID="ink"+iside+"hold"; var divExist=document.getElementById(inkdivID); if (divExist==null) { xmlhttpInk=GetXmlHttpObject(); if (xmlhttpInk==null) { alert ("Browser does not support HTTP Request"); return; } var url="/scripts/addink.php"; url=url+"?q="+iside+"&k="+ivalue; url=url+"&sid="+Math.random(); xmlhttpInk.onreadystatechange=InkChange; xmlhttpInk.open("GET",url,true); xmlhttpInk.send(null); } } function InkChange() { if (xmlhttpInk.readyState==4) { var newDiv=document.createElement("div"); newDiv.id=inkdivID; var objToInserBefore=document.getElementById(inkholdID); newDiv.innerHTML=xmlhttpInk.responseText; objToInserBefore.parentNode.insertBefore(newDiv,objToInserBefore); } } Here's the PHP file for it: PHP Code: mysql_select_db($database_geQuote, $geQuote); $query_inkList = "SELECT * FROM Ink ORDER BY Ink.InkID"; $inkList = mysql_query($query_inkList, $geQuote) or die(mysql_error()); $row_inkList = mysql_fetch_assoc($inkList); $totalRows_inkList = mysql_num_rows($inkList); $iside=$_GET["q"]; $k=$_GET["k"]; $ivalue=$k+1; echo "<p>Ink:"; echo "<select name='Ink".$iside."Data[".$k."][InkID]' class='dropMenu' onchange='addInkOpt(".$iside.",".$ivalue.")'>"; echo "<option value='NULL'></option>"; do { echo "<option value='".$row_inkList['InkID']."'>".$row_inkList['InkDesc']."</option>"; } while ($row_inkList = mysql_fetch_assoc($inkList)); $rows = mysql_num_rows($inkList); if($rows > 0) { mysql_data_seek($inkList, 0); $row_inkList = mysql_fetch_assoc($inkList); } echo "</select>Desc:"; echo "<input name='Ink".$iside."Data[".$k."][InkDesc]' type='text' class='inkdesc' maxlength='25' /><input type='hidden' name='Ink".$iside."Data[".$k."][InkID".$iside."]' value='' /></p>"; mysql_free_result($inkList); However, THIS script does not: Code: var xmlhttpStock; function getJobStock(str) { xmlhttpStock=GetXmlHttpObject(); if (xmlhttpStock==null) { alert ("Browser does not support HTTP Request"); return; } var url="/scripts/jobstock.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttpStock.onreadystatechange=JobStockChange; xmlhttpStock.open("GET",url,true); xmlhttpStock.send(null); } function JobStockChange() { if (xmlhttpStock.readyState==4) { document.getElementById("jobStock").innerHTML=xmlhttpStock.responseText; } } and it's PHP file: PHP Code: $q=$_GET["q"]; mysql_select_db($database_geQuote, $geQuote); $query_StockList = "SELECT Stock.StockName, Stock.StockID FROM Stock WHERE Stock.StockWeightID = ".$q." ORDER BY Stock.StockName"; $StockList = mysql_query($query_StockList, $geQuote) or die(mysql_error()); $row_StockList = mysql_fetch_assoc($StockList); $totalRows_StockList = mysql_num_rows($StockList); do { echo "<option value='".$row_StockList['StockID']."'>".$row_StockList['StockName']."</option>"; } while ($row_StockList = mysql_fetch_assoc($StockList)); $rows = mysql_num_rows($StockList); if($rows > 0) { mysql_data_seek($StockList, 0); $row_StockWList = mysql_fetch_assoc($StockList); } mysql_free_result($StockList); it should be the same thing, they're both using HTTP Requests, but the "getJobStock" script just returns no options, but ONLY in IE. In all other browsers PC or MAC it works fine. Could someone please help me figure out what the problem is? Similar TutorialsI've been running into some trouble with a script that just isn't working, and since I'm not encountering any error messages and a similar script on the same page is working just fine, I'm really puzzled. Anyways, here's the code I'm having trouble with: Code: function ShowHide(Numb){ Ident1 = AdIDList[Numb]+"Tx"; Ident2 = AdIDList[Numb]+"Lnk"; if (AdLink[Numb] == "hidden"){ document.getElementById(Ident1).style.height = "355px"; AdLink[Numb] = "visible"; } if (AdLink[Numb] =="visible"){ document.getElementById(Ident1).style.height = "55px"; AdLink[Numb] = "hidden"; } } And here's the page code calling it (The page is assembled via PHP from a database, but I'm grabbing the code from my browser) Code: <a href="#Good ShepherdLnk" id="Good ShepherdLnk" onclick="ShowHide(2);return false;" class="AdLink">Stories</a><br> And, here's a similar bit of code on the same page that is working just as it's supposed to. Code: function hideimage(){ for (Count=0; Count<AdTotal; Count ++){ if (VisPic[Count]=="visible"){ Ident = AdIDList[Count]+"AdB"; document.getElementById(Ident).style.visibility = "hidden"; VisPic[Count]="hidden"; } } } function bigimage(Item){ hideimage(); Ident1 = AdIDList[Item]+"AdB"; document.getElementById(Ident1).style.left="35%"; document.getElementById(Ident1).style.visibility = "visible"; VisPic[Item] = "visible"; } I'm not sure whether this is best posted here, or on a google maps api forum, but here goes: I have a site which uses a google map, and works well, like this: http://www.railwaysarchive.co.uk/eve...p?eventID=6684 I have built a version of that page which uses an OS map by default, but allows switching to a google map. It is he http://www.railwaysarchive.co.uk/osm...p?eventID=6684 The script uses a simple toggle as follows: Code: function toggleMap() { // toggle map div visibility var googlemap = document.getElementById("googlemap"); var OSmap = document.getElementById("OSmap"); if (OSmap.style.display!="block") { // currently hidden, show OSmap.style.display="block"; googlemap.style.display="none"; document.getElementById("maplink").innerHTML= "Switch to Google Map"; } else { OSmap.style.display="none"; googlemap.style.display="block"; document.getElementById("maplink").innerHTML= "Switch to OS Map"; } } I was having trouble getting both maps to load their respective data when one was hidden, so both maps start out with display:block and then the gmap is hidden during the <body onload>. This system works great with Firefox and with Chrome, but in IE if you switch to the google map the tiles don't load. Can anyone help? Relevant code snippets are as follows: Code: <body onload="createOSAccidentSummaryMap(52.6566359591919, -3.14070984721184, 7); createAccidentSummaryMap(52.6566359591919, -3.14070984721184, 'accident', 13); toggleMap();"> function createAccidentSummaryMap(dblLatitude, dblLongitude, enumType, lngZoom) { // creates a map with a single event marker, map type controls and full zoom controls // and centers it on the event coordinates if (GBrowserIsCompatible()) { // checks for compatible browser map = new GMap2(document.getElementById("googlemap")); map.addControl(new GSmallZoomControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom); map.enableDoubleClickZoom(); map.setMapType(G_HYBRID_MAP); var icon = createEventIcon(enumType); var point = new GLatLng(dblLatitude, dblLongitude); var marker = new GMarker(point, icon); map.addOverlay(marker); } } Hi - I have an ASP.Net 4.0 solution that runs fine on a Windows 2008 server. However, I've just been given a new Windows 7 64-bit machine to use as my development machine and I'm having a problem with one of my aspx pages. This page has some javascript on it, which runs fine, but then it gets to the following code: Code: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> This not code that I've written; it's code that's generated client-side that I see as I'm debugging my app in Visual Studio 2010 (trying to figure out what the $^#$ is going on). At any rate, once this code completes, the app does nothing. The debugger should take me to some server-side code, but it doesn't. It just sits there. The result is that the page doesn't do what it's supposed to do (no inserts to databases, no success messages, no nothing). As I said, this problem is restricted to my W7 64-bit machine; it runs fine on W2008. Other pages with javascript in the same solution work fine on my W7 machine. I found a post (http://dopostback.net/index.php/net-...anel-problems/) that discusses a similar issue within an UpdatePanel, but I'm not using UpdatePanel. My page does have hidden controls on it, but so do other pages that work just fine. Does anyone know what could be causing this? Thanks! Hi, I am trying to make a fuinction that, when called, will return the string that is retrned in text form from my php code. This is what i currently have, but it is just failing when it is run, what am i doing wrong? Code: function shortenUrl(url) { var response; var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "http://10.1.1.10/projects/short/?ext&url=" + encodeURIComponent(url), false); xmlhttp.send(null); xmlhttp.onload = function() { var response = xmlhttp.responseText; return response; } return "Failed!"; } alert(shortenUrl("http://www.google.com.au/")); Thanks Edit: ohh, and this is running chrome, so no standards issues I'm attempting to integrate a rich-text mail form and use PHPMailer to send HTML email to a Godaddy email account. The rich-text editor script is the WizzyWig one. (Original can be found Here) Location of form: http://www.westmichiganconcerts.com/contact.html Too much code to post here from all the different files involved, so I saved a version of each file as a TXT file, with it's original extention in brackets before it for easier code viewing (with the exception of the contact.html file above: Involved files: [.js]Rich-Text Editor: /scripts/whizzywig_61.txt [.js]File that spawns preview window: /scripts/load.txt [.php]File called by form action: test_mail.txt [.php]PHPMailer: /lib/PHPMailer_v5.1/class.phpmailer.txt [.php]Config file: /config.txt [.inc]Include file: MailClass.inc.txt Basic flow is: Customer goes to the Contact Page, then enters in rich text, and clicks "Preview" - this spawns a new window "DEMO" and writes the contents of the WizzyWig Iframe to a hidden field. From there, the customer can click "Submit", and it send the email to a Godaddy email account. Here's the problem: I've got a .replace command in the load.js file that replaces the double quotes with singles. If left as doubles, it completely breaks the code. When that email is received, all single quotes are backslashed(escaped?) ( \') so only portions of the HTML (that don't use quotes) show up. (examples: Highlight, insert image, insert link, spans, etc) I'm not fluent with Javascript, so I've been beating my head against the wall for 5 days now trying to get this to work. It's time to ask for some help lol. I'm not sure where / and in what file is causing this to break. Sent a test HTML email to the same Godaddy email address to make sure it could recieve HTML emails, and it worked fine. Any help would greatly be appreciated!! ~ John P.S.: I know there's browser issues with FF etc - I'll correct that once I can get the basic functionality of the pages to work I have an javascript coding issue with regards to a tabbed menu. The code is supposed to hide the unselected divs and show the selected div, but all divs are showing and no tab is selected when the page initialises. The source code is viewable he http://www.kenaani.co.uk I was following this tutorial: http://www.elated.com/articles/javascript-tabs/ Which works fine in this example: http://www.elated.com/res/File/artic...ript-tabs.html I have tried commenting out the other scripts, and the divs still show on the page, so I don't think its a conflicting issue. Am hoping that someone can spot whatever is going wrong. I'm hoping someone can help correct a small problem with this script, which is intended to highlight particular text strings. Background: The script is being used at a MediaWiki site, and is adapted from a working script from Wikipedia (highlightmyname.js). The original script highlights the logged-in user's username (represented by wgUserName). I've made a copy of the script, which you can see in full here, and adapted it to work on a pre-defined array of names, adding: Code: var Admin; var ArrayAdmins = ['Adam', 'Axiomist', 'Matt', 'Steve']; for (Admin in ArrayAdmins) I also replaced each instance of wgUserName with ArrayAdmins[Admin] The problem: is that, instead of highlighting all instances of every element in ArrayAdmins, only the last element listed ('Steve') is being used. So my question is, what change(s) need to be made to apply function highlightmyname to every element in ArrayAdmins? Any help would be hugely appreciated! I am trying to use a javascript plugin for jQuery library that transforms a regular select html element into a dropdown checkbox list (Dropdown Check List, see http://code.google.com/p/dropdown-check-list/), however I believe that the prototype library that I am loading immediately after the jquery library is still conflicting with it somehow even though I modified my code to reflect the following changes (which is supposed to allow the use of prototype with jquery): http://docs.jquery.com/Using_jQuery_...ther_Libraries (Including jQuery before Other Libraries) My code (in a cold fusion environment, which should be irrelevant) looks like this: Code: <html> <head> <SCRIPT LANGUAGE="JavaScript" SRC="js/jQuery/jquery.js" TYPE="text/javascript"></SCRIPT> <SCRIPT LANGUAGE="JavaScript" SRC="js/prototype.js" TYPE="text/javascript"></SCRIPT> <script language="javascript" type="text/javascript" src="js/jQuery/ui.core.js"></script> <script language="javascript" type="text/javascript" src="js/jQuery/ui.dropdownchecklist.js"></script> <script language="javascript" type="text/javascript"> jQuery(document).ready(function() { jQuery("#cbo_status").dropdownchecklist({ width: 200, maxDropHeight: 120 }); }); </script> </head> <body> <select id="cbo_status" name="cbo_status" multiple="multiple"> <option value="-1">All</option> <option value="1" SELECTED>Assigned</option> <option value="2" SELECTED>In Progress</option> <option value="3" SELECTED>Complete</option> <option value="4" SELECTED>Verified Resolved</option> <option value="5" SELECTED>Will not be addressed</option> <option value="6" SELECTED>Wishlist</option> </select> </body> </html> When I run the debugger, here's the error I'm still receiving: Error: Object doesn't support this property or method (pointing to the line below, character 3) jQuery("#cbo_status").dropdownchecklist({ width: 200, maxDropHeight: 120 }); Does anyone have any idea why this might still be failing? Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. Hello again . If these questions concerning Regular Expressions are inappropriate in this forum please let me know . Thank You. This expression <script[^>]*>.*?</script> matches ... Code: <script type="text/javascript">var cnnIsHomePage = true;</script> but not ... Code: <script type="text/javascript"> var cnnIsHomePage = true; </script> Please , how can i match the latter ? Hi I have found a script I would like to make a few changes to.. I have tried a few tricks but got me no-where. If you could help me I will be very much appreciated! Code: <HEAD> <script language="javascript"> <!-- //These are the names of the people you don't want //To add a person, just put their name in quotation marks //and add a comma after Names = new Array( "test1@email.com", "test2@email.com", "test3@email.com", "test4@email.com", "test5@email.com") function Check() { //Change FORM and FIELD to the form name and field name throughout this function namechk=document.FORM.FIELD.value.toLowerCase() awdrgy = 0 aLeRt = 0 while (awdrgy<=Names.length-1 && aLeRt!=1) { if (namechk==Names[awdrgy]) { aLeRt = 1 alert("Either your account is suspended or you entered an invalid email address! Please try again.") document.FORM.FIELD.value="" } awdrgy++ } } --> </script> </HEAD> <BODY> <form name="FORM"> <input name="FIELD" onblur="Check();" onblur> <input type="button" onclick=storytest() value="Submit" class="form"> </form> <!-- Script Size: 2.01 KB --> Basically What I want to happen is.. If a email entered that is listed in the reject list they will get an alert. (This currently does this) If a email was entered that's not listed it will submit the form. (Currently does not do this) I am making a login form that is complete but I wanted to add the above code to it.. If you or anyone could make it work the way I explained above I will be very much appreciated. Thanks, Chris Hello Everyone, Im having trouble at work. They asked me to write a script that will take the 25 first words of a web page and store it to use it later on in the back office of a platform. My problem is i do not know how to get javascript to view 25 words from a site. I wouldnt be able to touch the HTML on the Site. Is this possible? please help Quote: function hTools() { var hTools = new Array(6); hTools[0] = "hand tools"; hTools[1] = "saw"; hTools[2] = "hammer"; hTools[3] = "screwdriver"; hTools[4] = "wrench"; hTools[5] = "pliers"; } if(hTools[0] == true) { document.forms[0].item_one.value ="0"; } else if(hTools[1] == true) { document.forms[0].item_one.value ="$20.00" } then I call it fro an onchage selection list Quote: <p><select name ="hTool" onchange ="return hTools();"> <option value ="hTool0">Hand Tool</option> Quote: Item 1: <input type ="text" name ="item_one" My script or my call or both is not working could you please look at it and tell me what I am doing wrong Hi there, I'm not too familiar with js, so I'm asking for help I have this script below which loads flash object after clicking fb like button. My question is how to do it after clicking the fb like button automatically to recognize youtube flash object or an object from another tube site? Is it possible? Thank you in advance! Code: <script type='text/javascript'> window.fbAsyncInit = function() { FB.init({appId: "0000000000000", status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement("script"); e.async = true; e.src = document.location.protocol + "//connect.facebook.net/en_US/all.js"; document.getElementById("fb-root").appendChild(e); }()); FB.Event.subscribe('edge.create', function(href, widget) { setTimeout("playvideo1();", 0); }); function playvideo1() { document.getElementById('playvideo1').innerHTML = '<object ....... </object>'; } </script> Hi everyone, I just wrote a little noob script and JSL tester says no errors but I think there's some kind of problem.....can you help me fix the problem???? Code: function doattack(baseatk, wepatk, wepcritmax, oppdef, oppdeffactor, oppextradefmax, opphealth, oppname) { var OpponentHealth = opphealth; var OpponentName = oppname; var BaseATK = baseatk; var WeaponATK = wepatk; var WeaponCriticalMax = "100+Math.floor(Math.random()*wepcritmax+1)"; var ActualWeaponATK = "WeaponATK * WeaponCriticalMax / 100"; var OpponentDEF = oppdef; var DEFfactor = oppdeffactor; //defensefactor: used to multiply preoppdef to calculate actualoppdef so more in number the better rmbr that deffactor must be less than 1 var DEFCriticalMax = "100+Math.floor(Math.random()*oppextradefmax+1)"; var PreOpponentDEF = "OpponentDEF * DEFCriticalMax / 100"; var ActualOpponentDEF = "PreOpponentDEF * DEFfactor"; var DamageDone = "BaseATK + ActualWeaponATK"; var OVRDamageDone = "DamageDone * ActualOpponentDEF / 100"; document.write("You just inflicted " + OVRDamageDone + " damage to " + OpponentName + "!" + "<br>"); var NewOpponentHealth = "OpponentHealth - OVRDamageDone"; if (NewOpponentHealth < 0) { document.write(OpponentName + " is dead!" + "<br>"); break; } else { doattack(BaseATK, WeaponATK, WeaponCriticalMax, OpponentDEF, DEFfactor, DEFCriticalMax, NewOpponentHealth, OpponentName); } } doattack(5, 50, 25, 6, 0.22, 10, 200, RedBabyDragon); GREAT THANKS hi, can any tell me that which script they are using?? and plz if u have share it Thanx http://www.nation4all.org/mf/ regards Fawad |