1. 程式人生 > >JS視窗最大化(模擬最大化和點選最大化按鈕效果)

JS視窗最大化(模擬最大化和點選最大化按鈕效果)

<html>
	<head>
		<title>test</title>
		<script type="text/javascript">
		/*
		function isMobile(val){
			//相容格式: 國家程式碼(2到3位)-區號(2到3位)-電話號碼(7到8位)-分機號(3位)
			var telReg = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
			//驗證手機號
			var mobileReg = /^((\(\d{3}\))|(\d{3}\-))?13\d{9}|15[0-9]\d{8}$/;
			if(mobileReg.test(val) || telReg.test(val))
				return true;
			return false;
		}
		
		var testStr = "0712-aa";
		alert(isMobile(testStr));
		*/
		
		/*
		function testMax(){
			//var width = document.body.clientWidth;
			//var height = document.body.clientHeight;
			//var width = window.screen.width;
			//var height = window.screen.height;
			//document.getElementById("test").style.backgroundColor = "#000000";
			//document.getElementById("test").style.width = width+"px";
			//document.getElementById("test").style.height = height+"px";
			//window.resizeTo(screen.availWidth,screen.availHeight)
			//window.resizeTo(width, height);
		}
		*/
		</script>
	</head>
	
	<body id="test" onload="max.Click();">
		<object id="min" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
			<param name="Command" value="Minimize">
		</object>
		<object id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> 
			<param name="Command" value="Maximize">
		</object>   
	<body>
</html>