function f(){
var s="引用JS文件!";
document.open();
document.write(s);
document.close();
}
</script>
</head>
<body onloda="f()">為什么用函數也不行
var s="引用JS文件!";
document.open();
document.write(s);
document.close();
}
</script>
</head>
<body onloda="f()">為什么用函數也不行
2015-09-24
function openWindow(){
var info=confirm("要打開網頁嗎?");
if(info==true)
{
var mes='請輸入網址?';
var webUrl='http://www.xianlaiwan.cn';
webUrl=prompt(mes,webUrl)
{
window.open(webUrl,'width=400,height=500,toolbar=no,status=no');
}
}
else{}
}
var info=confirm("要打開網頁嗎?");
if(info==true)
{
var mes='請輸入網址?';
var webUrl='http://www.xianlaiwan.cn';
webUrl=prompt(mes,webUrl)
{
window.open(webUrl,'width=400,height=500,toolbar=no,status=no');
}
}
else{}
}
function openWindow(){
var info=confirm("sure?");
if(info==true)
{
var mes='this?';
var webUrl='http://www.xianlaiwan.cn';
webUrl=prompt(mes,webUrl)
{
window.open(webUrl,'width=400,height=500,toolbar=no,status=no');
}
}
else{}
}
var info=confirm("sure?");
if(info==true)
{
var mes='this?';
var webUrl='http://www.xianlaiwan.cn';
webUrl=prompt(mes,webUrl)
{
window.open(webUrl,'width=400,height=500,toolbar=no,status=no');
}
}
else{}
}
function openWindow() {
var newWeb = confirm("是否打開新的網頁");
var newWeb = prompt("請輸入你要打開的網站", "http://www.xianlaiwan.cn/")
if (newWeb == "http://www.xianlaiwan.cn/") {
window.open('http://www.xianlaiwan.cn/', '_black', 'width = 400, height = 500, menubr = no, toolbar = no')
} else {
null;
}
}
完整的代碼
var newWeb = confirm("是否打開新的網頁");
var newWeb = prompt("請輸入你要打開的網站", "http://www.xianlaiwan.cn/")
if (newWeb == "http://www.xianlaiwan.cn/") {
window.open('http://www.xianlaiwan.cn/', '_black', 'width = 400, height = 500, menubr = no, toolbar = no')
} else {
null;
}
}
完整的代碼
url=prompt("輸入打開網址","http//www.xianlaiwan.cn/");
alert(url)
window.open(url,'_blank','width=400,height=600');
alert窗口顯示url是http//www.xianlaiwan.cn/
但是新窗口中打開的網址是“http://www.xianlaiwan.cn/code/http//www.xianlaiwan.cn/”,擅自添加了http://www.xianlaiwan.cn/code/
alert(url)
window.open(url,'_blank','width=400,height=600');
alert窗口顯示url是http//www.xianlaiwan.cn/
但是新窗口中打開的網址是“http://www.xianlaiwan.cn/code/http//www.xianlaiwan.cn/”,擅自添加了http://www.xianlaiwan.cn/code/