弹出窗口/自定义窗口 弹出窗口分为三种:警告框/确认框/提示框。警告框没有返回值;确认框点击确认按钮返回true/点击取消按钮返回false;提示框点击确认按钮返回输入框的值,取消或关闭提示框返回
弹出窗口/自定义窗口
弹出窗口分为三种:警告框/确认框/提示框。警告框没有返回值;确认框点击确认按钮返回true/点击取消按钮返回false;提示框点击确认按钮返回输入框的值,取消或关闭提示框返回null。
window.onload=test;function test(){ var res=alert("nihao"); alert(res); /*var res=prompt("what's your name?","chen"); if(res==null){ alert("nihao"); }*/ /*var res=confirm("asdasdasd"); if(res==true){ alert("nihao"); } else{ alert("buhao"); }*/}
自定义窗口:
window.onload=test;function test(){var newWindow=window.open("http://www.baidu.com","new window", "height=300,width=400,toobar=no,location=no"); }
frame对象的灵活使用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><html> <head> <title>梦之都框架页示例</title> </head> <frameset rows="120, *, 80"> <frame src="index.html" /> <frame src="http://www.dreamdu.com/css/" /> <frame src="http://www.dreamdu.com/javascript/" /> <noframes> <body> 梦之都使用了框架技术,但是您的浏览器不支持框架, 请升级您的浏览器以便正常访问梦之都。 </body> </noframes> </frameset></html>