2013年5月2日 星期四

[HTML][Javascript] How to input a value, then send to select field


 




[HTML][Javascript] How to input a value, then send to select field


Method 1 :


 


var cf = document.forms[0];


var tbox=cf.List;


 


tbox.options[Policy]=new Option(MacAddress,MacAddress);


alert(tbox.options[Policy].text);


 


Method 2:


 


document.getElementById("List").add(new Option(MacAddress, Policy))


alert(document.getElementById("List").options[Policy].text);


 


Reference :



  1. JavaScript Reference Select and Option objects 用法介紹



 


 

Related Posts:

0 意見:

張貼留言