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,