最赞回答 / 慕仔3515669
可以将alert替换成return false;来达到按下取消键无操作的想法,我的代码如下<!DOCTYPE html><html><head><title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function ...
2019-08-02
function openwindow()
{
var open=confirm("确定打开窗户嘛?");
if(open==true)
{var website=prompt("网站?", "http://www.imooc.com/");
if(website!=null)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再见!"); }
}
{
var open=confirm("确定打开窗户嘛?");
if(open==true)
{var website=prompt("网站?", "http://www.imooc.com/");
if(website!=null)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再见!"); }
}
已采纳回答 / 宝慕林0015443
<p id="p1" >指的是初始默认样式,就是黑字。<p id="p2" class="one">指的是初始为样式one,红字。虽然点击后结果一致,但初始界面不同。
2019-07-31
function openWindow(){
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
}
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else{
alert("再见!");
}
}
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
}
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else{
alert("再见!");
}
}
function openWindow(){
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else
{alert("再见!");}
}
else
{alert("再见!");}
}
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else
{alert("再见!");}
}
else
{alert("再见!");}
}