當打開一個新窗口時,有些用戶想直接最大化顯示,不想再多一步操作。如果不在代碼中做出明確設置的話,這個一般來說是瀏覽器自己的設置問題。但用戶希望無論什么情況,無論瀏覽器處于什么樣的設置,都要讓這個彈出的窗口最大化,那么怎么辦呢?其實很好辦,只需要把幾句代碼,讓瀏覽器窗口從默認大小變成我們自己的設置。
復制代碼 代碼如下:
$(function(){
if (window.screen) {
var myw = screen.availWidth;
var myh = screen.availHeight;
window.moveTo(0, 0);
window.resizeTo(myw, myh);
}
});
復制代碼 代碼如下:
<html>
<head>
<title>hello</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"><param value="Maximize"></object>
<input type=button value=最大化 onclick=max.Click()>
</body>
</html>
<script type="text/javascript">
max.Click();
</script>
新聞熱點
疑難解答
圖片精選