function openWindow(){
var a = confirm("确定要打开新的窗口?");
if(a){
var b = prompt('请输入网址','http://www.imooc.com');
if(b!==null){
window.open(b,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
var a = confirm("确定要打开新的窗口?");
if(a){
var b = prompt('请输入网址','http://www.imooc.com');
if(b!==null){
window.open(b,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
}
<body>
<h1>宝马X6</h1>
<P id="con"> JavaScript是一种基于对象、事件驱动的简单脚本语言,嵌入在HTML文档中,由浏览器负责解释和执行,在网页上产生动态的显示效果并实现与用户交互功能。</P>
<script>
var abc=document.getElementById("con");
document.write("原始内容"+abc.innerHTML+"<br>");
abc.innerHTML="Ncw text";
document.write("修改后的内容:"+abc.innerHTML);
</script>
<h1>宝马X6</h1>
<P id="con"> JavaScript是一种基于对象、事件驱动的简单脚本语言,嵌入在HTML文档中,由浏览器负责解释和执行,在网页上产生动态的显示效果并实现与用户交互功能。</P>
<script>
var abc=document.getElementById("con");
document.write("原始内容"+abc.innerHTML+"<br>");
abc.innerHTML="Ncw text";
document.write("修改后的内容:"+abc.innerHTML);
</script>
2016-03-15
<p id="con">JavaScript</p>
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("结果:"+mychar); //输出获取的P标签。
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("结果:"+mychar); //输出获取的P标签。
2016-03-15
最赞回答 / chrisyuan
window.open("ans",'_blank','width=400px,height=500px,menubar=no,toolbar=no');中的ans应该去掉双引号
2016-03-14
已采纳回答 / 四十九
if 判断的时候 应该是“==” 而不是“=”, “==”是判断;你用的是“=”,“=”是用来赋值的 你把它给直接赋值成真的了 所以造成判断的时候 条件为真 一直打开新网页
2016-03-14
已采纳回答 / 芳的独家记忆
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>className属性</title><style> body{ font-size:16px;} .one{ border:1px solid #eee; width:230px; height:50p...
2016-03-14
function openWindow(){
var mywin = confirm("是否打开");
if (mywin){
var mywin2 = prompt("是否打开网址","http://www.imooc.com");
window.open(mywin2,'_blank','width=400px','height=500px','menubar=no','toolbar=no');
}
else }; };
var mywin = confirm("是否打开");
if (mywin){
var mywin2 = prompt("是否打开网址","http://www.imooc.com");
window.open(mywin2,'_blank','width=400px','height=500px','menubar=no','toolbar=no');
}
else }; };