JS实现网页全屏

小K的大师兄 2013-09-26 01:46:56
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="WTGS.ZHJC.Web.Index" %>

<!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 runat="server">
<title></title>
<script type="text/javascript">
function OpenPage() {
var udswin = window.open("Default.aspx", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
udswin.moveTo(0, 0);
udswin.resizeTo(window.screen.availWidth, window.screen.availHeight);
window.opener = null;
window.open('', '_parent', '');//不显示是否关闭窗体提示框
window.close();
udswin.focus();

//浏览器全屏
//var WshShell = new ActiveXObject('WScript.Shell')
//WshShell.SendKeys('{F11}');
}
</script>
</head>
<body onload="OpenPage();">
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

写了这样一个页面,目的是在登陆之后让网页全屏显示,但是在第一次登陆之后不管怎样都不能全屏,只有登陆之后退出再登陆的时候才可以全屏,这是为什么啊?大牛们给看看
...全文
169 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
t86911384 2013-09-26
  • 打赏
  • 举报
回复
1楼正解
引用 1 楼 c02645 的回复:
function   toFull(){   
  if(window.name=="fullscreen")return;   
  var a =window.open("","fullscreen","fullscreen=yes")   
  a.location = window.location.href   
  window.opener=null   
  window.close()   
}   
<body onload="toFull()"> 当前页全屏
happytonice 2013-09-26
  • 打赏
  • 举报
回复
经测试,第一次打开可以全屏。 或者 resizable=no ==》resizable=yes 试下
c02645 2013-09-26
  • 打赏
  • 举报
回复
function   toFull(){   
  if(window.name=="fullscreen")return;   
  var a =window.open("","fullscreen","fullscreen=yes")   
  a.location = window.location.href   
  window.opener=null   
  window.close()   
}   
<body onload="toFull()"> 当前页全屏

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧