<!DOCTYPE?html>
<html>
?<head>
??<title>?new?document?</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/>???
??<script?type="text/javascript">??
????function?openWindow(){
????????var?mymessage=confirm("是否打開新網頁");;
????????if(mymessage==true)
????????{
????????????var?url=prompt("請輸入網址","http://www.xianlaiwan.cn/");
???????????
????????????????window.open(url,'_blank','width=400,height=500';
????????}
????}
????
??</script>?
?</head>?
?<body>?
??<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/>?
?</body>
</html>這里的prompt里我輸入www.daidu.com為什么窗打開的還是慕課網,輸入http://www.baidu.com就可以打開百度為什么?(這是輸入www.baidu.com和www。imooc。com的結果) (輸入123是這個結果)這是為什么。。。。。
prompt獲取文本框內容及window.open的url參數問題
認手為妻
2016-03-23 16:42:57