<%if(request.getParameters("hasload")!=null){%> window.onload= function (){window.open('dest.jsp?hasload=1','_self','fullscreen=1');} <%}%>hasload判断是否已经刷新过,否则的话,你的页面一直死循环刷新的
晕了,逻辑反了 <%if(request.getParameters("hasload")==null){%> window.onload= function (){window.open('dest.jsp?hasload=1','_self','fullscreen=1');} <%}%>
<html>
<head>
<title>
JS模拟按键
</title>
<script type="text/javascript">
function $(id){return document.getElementById(id)}
function loadListener(){
$("testBtn").onclick=function(){
var WshShell = new ActiveXObject('WScript.Shell')
WshShell.SendKeys('{F11}');
}
}
window.attachEvent("onload",loadListener);
</script>
<body>
我要实现这样一个效果:<br/>
当鼠标点击下面这个button时,就触发键盘按键事件,并且按下的键要为 F11,这样当前窗口就会全屏.<br/>
<input type="button" id="testBtn" value="点我全屏化">
</body>
</head>
</html>
onload= "window.open('window.location.href=dest.jsp'','fullscreen=1');" 吗 我这样写有错
window.onload= function (){window.open('dest.jsp?hasload=1','_self','fullscreen=1');}
<%}%>hasload判断是否已经刷新过,否则的话,你的页面一直死循环刷新的
<%if(request.getParameters("hasload")==null){%>
window.onload= function (){window.open('dest.jsp?hasload=1','_self','fullscreen=1');}
<%}%>