JavaScript - Javascript Internet Explorer Issue, Extend
The problem stems from Internet Explorer's inability to expand questions in the FAQ section of my website ( link: http://phonesforyourcharity.com/faq.php ). Of course the expand function works in Firefox and Safari.
The <script type="text/javascript" src="js/faq.js"></script> in the source refers to: PHP Code: $(function(){ $("dd.answer") .hide(); $("dl.faq dt") .append("<br /><a href='#' title='Reveal Answer' class='answer-tab'>Answer</a>"); $(".answer-tab") .click(function(){ $(this) .parent().parent() .find("dd.answer") .slideToggle(); return false; }); }); Similar TutorialsHey guys, I am having a bit of a hassle getting IE8 and 9 to deal with a rollover properly. On this page: http://www.robleydesign.com/works/ If you rollover any of the projects a View Project button comes up. In Firefox, Safari, Chrome ect.. the area for the hit box on that link is large and easy to click. For some reason in Internet Explorer it becomes a huge frustration clicking the button. I can't figure out why its not treating the whole button as a block element. Hey everyone, this problem has been bothering me for awhile, so I decided to finally stop banging my head against a wall over it and seek out some help. I'm fairly new to web development, but through W3Schools and the almighty Google, I managed to make my way through developing a site for the company that I intern for. The site is designed to query a Microsoft Access database and display the results, so employees can see the results of tests run on another machine in a different area. I did not design the database or queries for this project, but assume that they function as they are supposed to. The way the website works is by displaying a form to the user with a number of check boxes (it varies by page) that each add another parameter to the query. When the query button is clicked, I used the "onclick" action of an HTML button to send the form data to a JavaScript function to be processed. The JavaScript function filters out what I need to send to a php page that runs the query. I send the information from the JavaScript function using an XMLHttpRequest, and replace a line of text in the HTML document with the returned results from the php script. I have tested the completed website in several browsers. It works flawlessly in Chrome, Firefox, and IE9. The problem is, it doesn't work with IE7 or IE8, and even though the company I work for is making a widespread upgrade to Windows 7 from XP within the year, they don't plan on moving beyond IE8. When I load the page in IE8 (I'm running WAMP as my server), I can see that my php scripts work just fine, because some of the fields used to configure the query are generated using php, and they appear as they should. However, when I click the form button that triggers the JavaScript function, nothing happens (IE7 and 8 both report "Error on Page"). I've gone through nearly every Internet Options settings, as far as I know, and I'm fairly certain that every setting related to scripting is enabled, though I've only tried testing the site on IE7 and 8 at work and not at home (where I have unlimited security access). Below is the HTML for the button that triggers the JavaScript function, "displayTable": Code: <input type="button" name="button" value="Show Results" onclick="displayTable(this.form)" /> I'm not sure how easily this problem can be fixed, so if anyone needs to see any other bits of code, I can provide those. But my main question is, does this sound like just some setting in IE7/8 that I don't know about (keeping in mind that, with all the settings the same, the site works fine in IE9), or does IE7/8 simply have some inherent flaw in interpreting JavaScript, and will it be necessary for me to rewrite my code taking some other approach, and if so, what language would be recommended in place of JavaScript in IE7/8? Thanks! Hello, I'm new to Javascript programming. I have designed a Javascript to carry information from one page to another. It works fine in firefox but does not work in internet explorer. Is there some coding that needs to be specified for my script to work in ie? Thanks hi everyone, I hope you can help me understand why my Javascript menu is different on Chrome browser. It is fine on Internet Explorer. Please see images. Internet Explorer Google Chrome I look forward to hearing from you. Ravi when this page is viewed in IE (8), IE tells me there's an error on the page. Quote: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0) Timestamp: Tue, 17 May 2011 14:29:31 UTC Message: Invalid argument. Line: 7 Char: 17603 Code: 0 URI: http://cpanel4.frontline.net/~ggarch...cufon/cufon.js Here's what that Javascript file looks like: http://pastebin.com/T2vgugm2 I honestly know very little about Javascript. I installed a wordpress theme that already contained this bit of Javascript so please be patient with me on this one. please advise. thanks in advance! I've got a flash music player (audioplay) on a site (yeah, I know, I hate music on websites too, but the client wants it). I'm using javascript to trigger "stop" and "play" and it works on every browser except IE 9+. The error in IE's developer says: SCRIPT438: Object doesn't support property or method 'stopMusic' Here's the javascript: Code: <script language="JavaScript" type="text/javascript"> function getPlayer(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName]; } else { return document[movieName]; } } function play2() { getPlayer('player2').playMusic(); } function stop2() { getPlayer('player2').stopMusic(); } </script> Here's the working example: EXAMPLE Hello, im new and hope you can help me out. I am running some javascript on my vbulletin forum. One is for some ad network to display ads, I noticed this working in firefox and chrome but not IE. After some investigation I realised my analytics javascript snippet is conflicting, if i remove the javascript for my analytics then the ads show in all web browsers. The two pieces of code a Analytics; Code: <script src="/mint/?js" type="text/javascript"></script> Ad network; Code: <script type="text/javascript"> var EB_campid='5336510241'; </script> <script src="http://www.zintext.com/showads.js" type="text/javascript"></script> Any help appreciated. Dave. Hello everyone, I have a very strange situation here where Internet Explorer popup a new window on only one of my <a> elements. I created multiple <a> elements that do the following: Code: <a href = "javascript:popup('overview1.php?pID=<?php echo $pID;?>')"> <button class = "button" type="button">Overview </button></a> <a href = "javascript:popup('overview1.php?aID=<?php echo $FinalID[$key];?>')" style="float:right;"> <button type="button"><img src="image/Details.PNG" height="20px" width="20px"> </button></a> <a href="javascript:popup('cart.php?aID=<?php echo ... ?>)</button></a> <a href="javascript:popup('addnew.php')"> <button class = "NavButton" type="button">Add New</button></a> Out of the four buttons/link, only the first one is working properly (Open a new popup window) Below is my simple javascript code to open a window. Code: function popup(url){ cuteLittleWindow = window.open(url, "littleWindow", "location=no,width=1020,height=650");; cuteLittleWindow.focus(); } I have no idea why ie is acting like this and all the other major browsers work just fine with my code. Please let me know what you think is the issue and I greatly appreciate your help. Reply With Quote 01-28-2015, 11:44 PM #2 laytonsdad View Profile View Forum Posts New Coder Join Date Jan 2015 Location USA Posts 19 Thanks 0 Thanked 1 Time in 1 Post Are you receiving any errors in the console? Reply With Quote 01-29-2015, 01:21 AM #3 cheukyin91 View Profile View Forum Posts New Coder Join Date Nov 2014 Posts 17 Thanks 6 Thanked 0 Times in 0 Posts No. I also tried to output something on the console inside the function but it doesn't write to console as well. So I think ie doesn't even call the javascript function onclick. Please let me know what to do, thanks! Reply With Quote 01-29-2015, 01:25 AM #4 laytonsdad View Profile View Forum Posts New Coder Join Date Jan 2015 Location USA Posts 19 Thanks 0 Thanked 1 Time in 1 Post Originally Posted by cheukyin91 No. I also tried to output something on the console inside the function but it doesn't write to console as well. So I think ie doesn't even call the javascript function onclick. If the first one works this is not the case. Are you sure that the PHP is inserting correct information? Did you check for errors after the click has been done or just when the page is loaded? Do you have a live version to see? Reply With Quote 01-29-2015, 02:37 AM #5 felgall View Profile View Forum Posts Visit Homepage Master Coder Join Date Sep 2005 Location Sydney, Australia Posts 6,745 Thanks 0 Thanked 666 Times in 655 Posts Attaching JavaScript to the href attribute produces unknown results. It never triggers an event and so regular JavaScript event processing doesn't work. In this instance the browser's popup blocker is expecting the request to open a new window to originate with a user event and so blocks the request because there is no event. Instead of: Code: <a href = "javascript:popup('overview1.php?pID=<?php echo $pID;?>')"> <button class = "button" type="button">Overview </button></a> use the following in the HTML Code: <button id="overview1" class="button" type="button">Overview</button> and in a <script> tag attached just before the </body> tag insert the following line of code: Code: document.getElementsById('overview1').onclick = function() {popup('overview1.php?pID=<php echo $pID;?>'); Repeat the change for the other buttons (you only need the one script tag wrapped around all the JavaScript). Hi, I'm fairly new to javascript, I created a javascript image gallery using a tutorial found on web monkey. Please see below: Code: <script language="JavaScript" type="text/javascript"> <!-- var interval = 1500; var random_display = 0; var image_dir = "images/exhibition/" var ImageNum = 0; imageArray = new Array(); imageArray[ImageNum++] = new imageItem(image_dir + "exhibition-sealskinz.png"); imageArray[ImageNum++] = new imageItem(image_dir + "exhibition-orchard.png"); var number_of_image = imageArray.length; function imageItem(image_location) { this.image_item = new Image(); this.image_item.src = image_location; } function get_ImageItemLocation(imageObj) { return(imageObj.image_item.src) } function randNum(x, y) { var range = y - x + 1; return Math.floor(Math.random() * range) + x; } function getNextImage() { if (random_display) { ImageNum = randNum(0, number_of_image-1); } else { ImageNum = (ImageNum+1) % number_of_image; } var new_image = get_ImageItemLocation(imageArray[ImageNum]); return(new_image); } function getPrevImage() { ImageNum = (ImageNum-1) % number_of_image; var new_image = get_ImageItemLocation(imageArray[ImageNum]); return(new_image); } function prevImage(place) { var new_image = getPrevImage(); document[place].src = new_image; } function rotateImage(place) { var new_image = getNextImage(); document[place].src = new_image; var recur_call = "rotateImage('"+place+"')"; timerID = setTimeout(recur_call, interval); } // --> </script> However unfortunately there are two issues, one is IE6 is coming up with javascript errors and IE7 gets an error when you click the previous button on the first image. The buttons look like this: Code: <div id="left-arrow-container"><a href="#" onClick="prevImage('rImage'); clearTimeout(timerID)"><img src="images/left-arrow.png" alt="left arrow" name="leftarrow" width="58" height="37" border="0" id="leftarrow" /></a></div> <div id="see-the-whole-project"> see the whole project</div> <div id="right-arrow-container"><a href="#" onClick="rotateImage('rImage'); clearTimeout(timerID)"><img src="images/right-arrow.png" alt="right arrow" name="rightarrow" width="58" height="36" border="0" id="rightarrow" /></a></div> Being new to javascript I don't know how to get round these issues so if anyone could advise me I would really appreciate it. Thanks Gary Hi All, This is my first post in this forum. I am relatively new to javascript. Hope I get some guidance here. Also I would like to contribute here when I get little expertise on javascript. I have developed following snippet of code, which is working very well with firefox 6.0. But when it comes to IE 8.0, it just does not work. Quote: <SCRIPT LANGUAGE="JavaScript"> function refreshFrame() { frames['top'].window.location.href = "report.php?parent_id=<? echo $parent_id; ?>"; } </script> </head> <? include('style.php'); include('PHP_functions.php'); print(" <FRAMESET rows='96,100' onLoad=refreshFrame() BORDERCOLOR=blue BORDER=0> <FRAME SRC=blank.html SCROLLING=NO NORESIZE NAME=top> <FRAME SRC=manage.php?view=show_all&parent_id=$parent_id NAME=bottom> </FRAMESET> "); ?> </HTML> In the above script, I am trying to load the frame top after loading frame bottom, as the latter takes more time to load due to some processing involved. Till frame bottom is under processing stage, I display a message "Processing Please wait" which is coming from blank.html. Working under Firefox: It loads blank.html first and displays the message as "processing please wait". Once frame bottom has completed the processing it displays its contents at second half of the webpage. Then finally frame top gets loaded on first half of the web page. This is the expected result. Here URL does not change as the URL remains same as before "http://xyz.com/index.html" Not Working under IE It loads blank.html first and displays the message as "processing please wait". Once frame bottom has completed the processing it displays its contents at second half of the webpage. Then finally frame top gets loaded on whole page instead of first half of the page. Here URL changes to complete new URL as "http://xyz.com/report.php?parent_id" Can anyone please suggest what could be reason for this. Thanks, Vinay i'm having a problem getting something called JavaScript Bitcoin Miner working in IE6+ the error i'm getting is: Line: 8 Char: 6 Error: 'JSON' is undefined Code: 0 URL: http://192.168.0.105/Bitcoin_Miner/index.html does anyone know how i can get this working? thanks. Attached is the source files. BTW... you'll need to instal XAMPP to get this working correctly on your local PC. But if there's a way all of the PHP can be converted to PHP, and Jquery can be cut out of the picture, it would be VERY helpful It works in Google Chrome but not Firefox and Internet Explorer. My computer has blocked Opera and I don't know how to change that. Too much energy to investigate now, I'll do so later. Are there any pros that can tell me why this is happening? I'm assuming GoogleChrome is fixing a syntax error that FF and IE don't. Code: var request; request=false; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } function isAlNum(str){ return /^[a-z0-9]+$/i.test(str); } var preUsername; var same; function updatePage() { if (username.value.length>0){ if ( request.responseText.indexOf("0") == -1 ) {userNameErrorBox.innerHTML=username.value + " has already been taken"; usernameSuccessBox.innerHTML="";} else {userNameErrorBox.innerHTML=""; usernameSuccessBox.innerHTML=username.value + " is available";}} } function nameTest() { if (username.value==preUsername) {same=1;} else {same=0;} if (!isAlNum(username.value)) {if (username.value.length>0) {username.value=preUsername;}} else {preUsername=username.value;} if (username.value.length>0 && username.focus && same===0) { userNameErrorBox.innerHTML="";usernameSuccessBox.innerHTML=""; request.abort(); var url = "/unseen/checkIfUserNameExist.php?name=" + username.value; request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } if (username.value.length===0) { userNameErrorBox.innerHTML="";usernameSuccessBox.innerHTML="";preUsername=""; } } I back tracked what i did and it appears that this code Code: var url = "/unseen/checkIfUserNameExist.php?name=" + username.value; request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); has the problem. When I set up alerts to see what works and what doesn't, this code seems to be causing the FF and IE to not work, but I can't tell what it is that's causing them to fail. This is javascript that is suppose to check if a name has been taken by another user. I'm working on a fairly large project that I wish to be the new formspring, (size wise) I procrastinated for 2 weeks of my 12 week break and now that I'm just getting started on it I'm running into an ishness load of problems... Very de-motivating Hi there - I was wondering if anyone out there could help me I'm redoing my site from many years ago - www.industrialarts.co.uk It contains a "Conveyor" - to which I've always wanted to add a "Lightbox" effect. Well - the good news is that I've managed to get a test page up and running and it's doing exactly what I want it to in Firefox, Chrome, Opera and in Safari However .. in Internet Explorer 8 .. it ain't good. The scripts on the page seem not to work at all. (In Internet Explorer 7, it's worse as the formatting is haywire too - but I'll try to fix one thing at a time) http://www.industrialarts.co.uk/test/chairs/chairs.html So - if anybody could be good enough to take a look at my test page and offer any suggestions for getting it running on Internet Explorer too .. or just where to look for answers - I'd be massively grateful My apologies also as I'm a dabbler with this stuff (normally a woodworker) Cheers, Jol Hi There, Can anyone explain why the following XMLHttpRequest.open call fails on IE browsers, but works fine in Firefox and Chrome? Code: <html> <head> </head> <script type="text/javascript"> if( window.XMLHttpRequest ) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","test.xml",false); // I show an "access is denied error in IE" xhttp.send(""); document.write( xhttp.responseXML.getElementsByTagName("simple")[0].childNodes[0].nodeValue ); </script> <body> </body> </html> The "text.xml" file resides in the same location (local HDD folder on the pc this is running on) as the html page. And the contents of "test.xml" are shown below: Code: <simple> Hello </simple> Obviously its just a very simple example that should just display "Hello" when loaded, but it fails to work in IE. I am using HAPedit for HTML/Javascript and it used to work alright by clicking Display -> Browse with -> Default Browser(Internet Explorer). But since last one or two days it gives the following error "The page cannot be displayed" and the following is shown in the URL bar http://localhost/helloworld.html 2. But, however, if I navigate to the file by using File -> Open of the IE, the result is shown correctly. 3. What has gone wrong?? I have javascript code in my site. It works in FireFox but doesn't work in IE. The page is http://omidpand.ir/search.html First select something from first combobox when u open second combobox the javascript code should change latin characters with persian one, but it doesn't do it. i'm looking for a function to check for the browser version and NOT run a script if the user is using internet explorer 7 or less something like <!--[if gte IE 7]> alert(internet explorer 6 sucks) <!--[else]> alert(internet explorer 7 or greater is better but it still sucks) <![endif]--> and if i just use "lte IE 7" instead of gte IE 7 it will exclude firefox... so that's why i prefer to use a "else" statement.... instead you got something better to suggest thanks!! I have the following Javascript function that just refuses to work in Internet Explorer (since IE is absolute .......). Can anybody tell me why this wouldn't be working in IE and what I need to do to fix it? I am new to Javascript so don't really have any idea Code: function displaymember() { var d = new Date(); var curr_date = d.getDate(); if (curr_date < 10) curr_date = "0" + curr_date; var curr_month = d.getMonth(); curr_month++; if (curr_month < 10) curr_month = "0" + curr_month; var curr_year = d.getFullYear(); //alert("date="+curr_date+" month="+curr_month+" year="+curr_year); for (i = 0; i < x.length; i++) { membershipstatus = (x[i].getElementsByTagName("membership_status")[0].childNodes[0].nodeValue); name = (x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue); body = (x[i].getElementsByTagName("body_type")[0].childNodes[0].nodeValue); ethnicity = (x[i].getElementsByTagName("ethnicity")[0].childNodes[0].nodeValue); sex = (x[i].getElementsByTagName("sex")[0].childNodes[0].nodeValue); profession = (x[i].getElementsByTagName("profession")[0].childNodes[0].nodeValue); seeking = (x[i].getElementsByTagName("seeking")[0].childNodes[0].nodeValue); date = (x[i].getElementsByTagName("date_joined")[0]); month = (date.getElementsByTagName("month")[0].childNodes[0].nodeValue); year = (date.getElementsByTagName("year")[0].childNodes[0].nodeValue); newa = document.createElement('a'); aIdName = 'my' + i + 'a'; ahref = '#'; aclick = 'show(' + i + ')'; newa.setAttribute('id', aIdName); newa.setAttribute('href', ahref); newa.setAttribute('onclick', aclick); newa.innerHTML = name + " | " + body + " " + ethnicity + " " + sex + " " + profession + " with " + membershipstatus + " membership seeks " + seeking + "<br/>"; if (curr_month == month && curr_year == year) { document.getElementById("member").appendChild(newa); } } } I am hoping that someone can figure out why this simple javascript works fine in Firefox, but not in IE8. I appreciate any help. PS: I see it DOES work in IE9... but I can't use it if I cannot make it work in IE8 as well. Sincerely, Buffmin 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>test</title> <script type="text/javascript" src="jquery-1.6.2.js"></script> <script type="text/javascript"> $(document).ready(function() { switches = $('#switches > li'); slides = $('#slides > div'); switches.each(function(idx) { $(this).data('slide', slides.eq(idx)); }).hover( function() { switches.removeClass('active'); slides.removeClass('active'); $(this).addClass('active'); $(this).data('slide').addClass('active'); }); }); </script> <style type="text/css"> #switches .active { font-weight: bold; } #slides div { display: none; } #slides div.active { display: block; } </style> </head> <body> <ul id="switches"> <li class="active">First slide</li> <li>Second slide</li> <li>Third slide</li> <li>Fourth slide</li> </ul> <div id="slides"> <div class="active">Well well.</div> <div>Oh no!</div> <div>You again?</div> <div>I'm gone!</div> </div> </body> </html> Here I am again. In Internet Explorer 7, running on Windows Vista I am testing a project. I get an error message when the page loads to the effect: line 31 char 29 error: object does not support this property or method code 0 This is a one page site and this message comes up on every page load. So I have a good idea what it is complaining about. But in I.E., how do I determine 'line 29'? Where does it start counting, and what type of lines would it skip? I.E. loads source into notepad and notepad does not number the lines. Further, the lines in the source are formatted unix style ("\n" line feed endings instead of line feed/carriage return: as in Windows). Long lines are wrapped, so it is unclear where one line ends and the next starts. Are there any good web dev tools for I.E.(preferreably open source)? Thank you; JK |