Select box option add works in IE but not Firefox
In Firefox the "alert("backupopt2="+backupopt);"
does not execute i.e. there appears to be a problem with "backupelement.add(backupopt);"
. Nothing on the Java console. Assistance appreciated; thanks.
for(i = 0; i < backupresponsesplit.length; i++)
{
var backupopt = document.createElement("OPTION");
var backupelement = document.getElementById("metarecords");
backupopt.text = backupresponsesplit[i];
backupopt.value = backupresponsesplit[i];
alert("backupopt1="+backupopt);
backupelement.add(backupopt);
alert("backupopt2="+backupopt);
}
<select size="3" id="metarecords" style=开发者_JAVA百科"width:845; height:54; font-family:monospace" onChange="ajaxMeta();">
</select>
Assuming metarecords id belongs to a select tag instead of 'add' try this
backupelement.appendChild(backupopt);
精彩评论