function openWindow(){
// 新窗口打开时弹出确认框,是否打开
var result = confirm("是否打开新窗口");
if(result==true){
var win = prompt("请输入要打开的网址","http://www.imooc.com");
if(win=="http://www.imooc.com"){
window.open(win,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
}
}
// 新窗口打开时弹出确认框,是否打开
var result = confirm("是否打开新窗口");
if(result==true){
var win = prompt("请输入要打开的网址","http://www.imooc.com");
if(win=="http://www.imooc.com"){
window.open(win,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
}
}
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300";
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300";
2016-01-07
var mychar=document.getElementById("con") ;
document.write("原标题:"+mychar.innerHTML+"<br>");
mychar.innerHTML="Hello world"
document.write("修改后的标题:"+mychar.innerHTML);
document.write("原标题:"+mychar.innerHTML+"<br>");
mychar.innerHTML="Hello world"
document.write("修改后的标题:"+mychar.innerHTML);
2016-01-07
<script type="text/javascript">
function Wopen(){
window.open('http://www.baidu.com','_blank','width=600,height=400,top=100,left=100') ;
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
function Wopen(){
window.open('http://www.baidu.com','_blank','width=600,height=400,top=100,left=100') ;
}
</script>
</head>
<body>
<input name="button" type="button" onClick="Wopen()" value="点击我,打开新窗口!" / >
</body>
</html>
2016-01-06
var message = confirm("是否打开");
if(message==false)
{
return ;
}
var webadd = prompt("你要打开的网站为","http://www.imooc.com/");
if(webadd == "http://www.imooc.com/")
{
window.open('http://www.imooc.com/','_blank','width=400px','height=500px','menubar=no','toolbar=on');
}
}
if(message==false)
{
return ;
}
var webadd = prompt("你要打开的网站为","http://www.imooc.com/");
if(webadd == "http://www.imooc.com/")
{
window.open('http://www.imooc.com/','_blank','width=400px','height=500px','menubar=no','toolbar=on');
}
}
confirm 消息对话框通常用于允许用户做选择的动作,如:“你对吗?”等。弹出对话框(包括一个确定按钮和一个取消按钮)。
语法:
confirm(str);
参数说明:
str:在消息对话框中要显示的文本
返回值: Boolean值
返回值:
当用户点击"确定"按钮时,返回true
当用户点击"取消"按钮时,返回false
语法:
confirm(str);
参数说明:
str:在消息对话框中要显示的文本
返回值: Boolean值
返回值:
当用户点击"确定"按钮时,返回true
当用户点击"取消"按钮时,返回false
2016-01-06