开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜