开发者

Select box option add works in IE but not Firefox

开发者 https://www.devze.com 2023-03-14 00:41 出处:网络
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; than

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

精彩评论

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