html:
〈input id="me" type="button" value="click" /〉〈select id="dropdown"〉〈/select〉
javascript/jQuery:
var options=[{"value":"USA","text":"美國"},
{"value":"TWN","text":"台灣"},
{"value":"CHN","text":"中國"},
{"value":"XXX","text":"XX國"}
];
$("#me").click(function(){
$.each(options,function(i,data){
//alert("i = " + i + ", value = " + data.value + ", text = " + data.text);
$("#dropdown").append(
""
);
});
});
沒有留言 :
張貼留言