js-Bom对象

1.实例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>运行代码</title>
<script>
window.onload=function ()
{
	var oTxt=document.getElementById('txt1');
	var oBtn=document.getElementById('btn1');
	
	oBtn.onclick=function ()
	{
		var oNewWin=window.open('about:blank');  //打开新页面
		
		oNewWin.document.write(oTxt.value);     //在新页面上输出
	};
};
</script>
</head>

<body>
<textarea id="txt1" rows="10" cols="40"></textarea><br />
<input id="btn1" type="button" value="运行" />
</body>
</html>

 2.window.location='http://www.miaov.com/'  打开一个新链接 

3.查看浏览器类型  alert(window.navigator.userAgent);

posted @ 2015-06-29 22:03  越来越好888  阅读(162)  评论(0编辑  收藏  举报