vendredi 28 mars 2014

Problems using innerHTML


Vote count:

0




I am adding this output query from a sql over this HTML select code.



<select name="state" onchange="getCity(<?=$country?>,this.value)">
<option>Select State</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value=<?=$row['id']?>><?=$row['statename']?></option>
<? } ?>
</select>

<td ><select name="state" id="statediv">
<option>Select Country First</option>
</select></td>


For that I’m using the innerHTML but doesn’t show me anything.



req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {

document.getElementById('statediv').innerHTML(req.responseText);

} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);


I try to use appendchild besides innerHTML but puts me everything in one row of the select option.



asked 22 secs ago






Aucun commentaire:

Enregistrer un commentaire