473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with IE in javascript, tested ok with Firefox,Opera, Safar &,Chrome

I have two selection list, which the second one populates depending at the selection of the first.

Expand|Select|Wrap|Line Numbers
  1.       <select id="category" onchange="getRegions('1',this.value,'region','imagediv1')" >
  2.         <option selected="selected" value="" > Please Select Category</option>
  3.          <?php
  4.          do {  
  5.           print ("<option value=\"".$row_Recordset1['id_categories_pk']."\"");
  6.  
  7.           print(">".$row_Recordset1['category_name']."</option>");
  8.  
  9.         } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  10.               $rows = mysql_num_rows($Recordset1);
  11.                   if($rows > 0) {
  12.                       mysql_data_seek($Recordset1, 0);
  13.                       $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  14.                   }
  15.         ?>
  16.       </select>
Second one
Expand|Select|Wrap|Line Numbers
  1. <select id="region" onChange="getImage('category',this.value,'imagediv1')" >
  2.     <option selected value="">Select Category First</option>
  3.      </select></div></td>

Expand|Select|Wrap|Line Numbers
  1. function getRegions(languageId,categoryId,element) {        
  2.  
  3.         enable_list(element);
  4.         var strURL="regions.php?language="+languageId+"&category="+categoryId;
  5.  
  6.         var req = getXMLHTTP();
  7.  
  8.         if (req) {
  9.  
  10.             req.onreadystatechange = function() {
  11.                 if (req.readyState == 4) {
  12.                     // only if "OK"
  13.                     if (req.status == 200) {                        
  14.                         document.getElementById(element).innerHTML=req.responseText;                        
  15.                     } else {
  16.                         alert("There was a problem while using XMLHTTP:\n" + req.statusText);
  17.                     }
  18.                 }                
  19.             }            
  20.             req.open("GET", strURL, true);
  21.             req.send(null);
  22.         }
  23.  
  24.     }
The problem ( only in IE), the second list is complete blank.I think the problem is at getRegions('1',this.value,'region') with this.value or with getElementById.

What i have to change to above code so the IE will be ok?
Sep 7 '09 #1
1 1313
acoder
16,027 Expert Mod 8TB
This is an IE bug: see here. However, don't use outerHTML. Use a loop to add each option individually.
Sep 8 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: addled | last post by:
Hi there, after reading posts here for a few months, I've built the courage to see if someone can see where I"m going wrong in the webpage I've been working on. In particular the horizontal nav...
4
by: Ryan Gaffuri | last post by:
I know that this works. I just don't get the syntax. I know its checking the OS. just not sure how it works. var v = navigator.appVersion.toUpperCase() if (1+v.indexOf('WIN98') os =...
2
by: Rick | last post by:
Hi.. I've got some code I wrote in PHP that will generate an HTML page with embedded javascript which in turn creates a new argument string for the browser, but the xhtml parser in Firefox and...
3
by: eft0 | last post by:
I have a big problem after I install SP2 in XP Box, some functions - window.resizeBy() - in my code, give a error like this: Access Denied. Some similar experience ?, any ideas what's...
8
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var...
34
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
13
by: BMc | last post by:
I just want to take a moment to say thank you to so many of you who posted a response to my request for help about the problem with THE GAP (see below?)! Your suggestions were not only a...
6
by: freddukes | last post by:
Okay... Goole Chrome and FireFox show my site perfect, however, IE refuses to display it perfectly... The site I'm looking at is here and the part I'm looking at is the navigation bar and just...
5
by: Jivanmukta | last post by:
Hello, I am learning JavaScript and I have a question concerning constants in JavaScript: Why JSLint (http://www.jslint.com/) reports error on the following code: const reEmail =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.