感覺是這樣
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" http-equiv="content-type" content="text/html"/>
<title></title>
<script type="text/javascript">
function newwin(){
var newpid =confirm("是否打開");
if(newpid ==true){
var proid = prompt("請輸入網(wǎng)址","http://idcbgp.cn");
if(proid!=null){
window.open("http://idcbgp.cn");
}else{
}
}
else{
}
}
</script>
</head>
<body>
<form>
<input type="button" value="點擊" name="id1" onclick="newwin()" />
</form>
</body>
</html>
2018-10-31
var proid = prompt("請輸入網(wǎng)址","http://idcbgp.cn"); 這個語句返回值要么是輸入的網(wǎng)址,要么就是http://idcbgp.cn, 這個缺省顯示的字符串同時也是缺省返回值。