1 <input type="button" value="打开选择输入框"/> 2 <script type="text/javascript"> 3 4 //IE有效 chrome无效 模式 与非模式 5 //window.showModalDialog("asdfasdf"); 6 //window.showModelessDialog("asdfasdf"); 7 //定位按钮,同时添加事件 8 document.getElementsByTagName("input")[0].onclick=function(){ 9 //以模式和非模式方式打开窗口 10 var url = "childNodes.html"; 11 var sFeatures = "dialogHeight:400px;dialogWidth:200px;dialogLeft:20%"; 12 13 14 15 window.showModalDialog(url,null,sFeatures);//模式(用途较多) 16 //window.showModelessDialog(url);//非模式 17 } 18 </script>