<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>测试文件</title> <script> window.onload = function(){ //创建select控件 var _select = document.createElement("SELECT"); //添加选项 for(var i=1; i<=10; i++){ var _option = new Option(i,i); _select.options.add(_option); } //选中值发生改变时的处理函数 _select.onchange = function(){ alert(_select.value); //取select控件被选中的值 } document.body.appendChild(_select); } </script> </head> <body> </body> </html>