innerHTML in IE7 vs FF, working fine in FF but not IE |
innerHTML in IE7 vs FF, working fine in FF but not IE |
kryles |
Jan 16 2008, 10:32 AM
Post
#1
|
Novice Group: Members Posts: 21 Joined: 30-November 07 Member No.: 4,437 |
Hi,
I have a select box for states/Provinces that is filled, and I want it to change according to the country chosen. the JavaScript function is called (tested using alert() ), but in IE7 it fails at the following line CODE function check_country() { var sel_country = document.getElementById("country"); if(sel_country.value == "US") { <?php $query = " SELECT stateName, stateAbbrev FROM states WHERE stateEnabled = '1' ORDER BY stateName ASC"; $result = mysql_query($query); $prov = "<select name=\"state\" id=\"state\" class=\"widthed\">"; while($row = mysql_fetch_row($result)) { $prov .= "<option value=\"$row[1]\">$row[0]</option>"; } $prov .= "</select>"; ?> document.getElementById("tab1").rows[2].cells[3].innerHTML = "*State:"; document.getElementById("tab1").rows[3].cells[0].innerHTML = "*Zip Code:"; document.getElementById("tab1").rows[2].cells[4].innerHTML = <?php echo $prov; ?>; //fails here } Notice the two lines above it work, which use getElement and innerHTML the same way. Could it be because it outputs a string not in quotes? This works just fine in FF but fails at the specified line in IE Thanks, |
kryles |
Jan 16 2008, 01:54 PM
Post
#2
|
Novice Group: Members Posts: 21 Joined: 30-November 07 Member No.: 4,437 |
CODE document.getElementById("tab1").rows[2].cells[4].innerHTML = '<?php echo $prov; ?>'; is the fix. I tried double quotes and not single /embarrased |
Lo-Fi Version | Time is now: 19th March 2024 - 07:41 AM |