页面全屏问题,类似于按F11的效果。考试系统

starsxingxing 2009-07-05 07:00:22
大虾们好,小弟又要向各位请教个问题了。
小弟现在遇到了个网上已问过很多、回答次数也很多的问题。
网上提到过:瞒天过海法-javascript:window.open("12.htm","","fullscreen=1,menubar=0,toolbar=0,directories=0,location=0,
status=0,scrollbars=0")、借尸还魂法、返璞归真法。
均没有达到页面完全全屏的效果。可能是小弟理解能力差,嘿嘿。
小弟现在做的是考试系统,根据其需求要把 试卷页面全屏化,防止作弊。
与按F11的效果类似,但与其不同的是:按F11时,当鼠标移动到页面顶部时,会将标题、地址、菜单栏之类的都给弹出来,而我不需将它们弹出来。请问需怎么设置才能到达该效果?
...全文
1275 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
scsxd 2010-08-24
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 eugenepada 的回复:]
刚才在朋友的IE7下测了下,也是可以的

1.html

HTML code

<script>
function MachakFull(Ie,other){
x=screen.availWidth;
y=screen.availHeight;
target = parseFloat(navigator.appVersion.substring(navi……
[/Quote]
这个代码,我在IE6和IE8下都测了,都有效果啊,IE7我这没有。。。
wantchina 2009-09-28
  • 打赏
  • 举报
回复
昨晚研究了很晚,我的结论是:楼主一直是在强调没有达到全屏效果,但很多网友说已经在IE7中测试通过,其实你们说的都对,当你的页面是以单独一个放在硬盘的html文件单独打开时,打开效果非常好,当置于web项目时:http://localhost/exam/test.html时,该页面的全屏效果是不太满意的,这就是楼主一直不满的原因。谁能接着研究?
starsxingxing 2009-07-14
  • 打赏
  • 举报
回复
[Quote=引用 20 楼 eugenepada 的回复:]
quote:

Windows XP Service Pack 2 offered a number of security related
enhancements to Internet Explorer, this being one of them.

Users of Internet Explorer got sick of Web sites opening a window
fullscreen and "stealing" their desktop. In a lot of cases, people had no
idea how to rid themselves of the fullscreen page. Many Windows users do
not know about Alt+Tab and even those th…
[/Quote]

首先,想说声抱歉,上星期忙别的事去,隔了这么久才回复大哥您的解答。
虽然没有从根本上解决问题,但还是谢谢大哥,同时也把分给您。辛苦了。

我想要实现页面完全全屏,在sp2和IE7下用js可能实现不了。
估计是要写个什么插件,我以前看过一个网络考试系统,在sp2和IE7下可以实现全屏。
同时把该网址晒出来:http://test.xuancai.com/TestSite/Login.aspx
但是用户名和密码是一次性的,呵呵
eugenepada 2009-07-07
  • 打赏
  • 举报
回复
刚才在朋友的IE7下测了下,也是可以的

1.html

<script>
function MachakFull(Ie,other){
x=screen.availWidth;
y=screen.availHeight;
target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length));
if((navigator.appVersion.indexOf("Mac")!=-1) &&(navigator.userAgent.indexOf("MSIE")!=-1) &&(parseInt(navigator.appVersion)==4))
window.open(other,"sub",'scrollbars=yes');
if (target >= 4){
if (navigator.appName=="Netscape"){
var MachakFull=window.open(other,"MachakFull",'scrollbars=yes','width='+x+',height='+y+',top=0,left=0');
MachakFull.moveTo(0,0);
MachakFull.resizeTo(x,y);}
if (navigator.appName=="Microsoft Internet Explorer")
window.open(Ie,"MachakFull","fullscreen=yes");
}
else window.open(other,"sub",'scrollbars=yes');
}
</script>
<body>
<a href="javascript:void(MachakFull('2.html'));">开始考试</a>
</body>


2.html

<body>
^_^ <div>success if you see this page</div>
</bdoy>
starsxingxing 2009-07-07
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 eugenepada 的回复:]
别人写的,我在IE6下测了,是可以的


JScript code
function MachakFull(Ie,other){
//Copyright ?1999 m.milicevic machakjoe@netscape.net jjooee@tip.nl
x=screen.availWidth;
y=screen.availHeight;
target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length));
if((navigator.appVersion.indexOf("Mac")!=-1) &&(navigator.userAgent.indexOf("MSI…
[/Quote]

eugenepada大哥,谢谢您的解答。
小弟有些不解:function MachakFull(Ie,other)的两个参数应该是需要全屏的页面的路径,为什么要用两个不同的参数呢?
还有就是,如果客户端是IE7呢?可以达到全屏吗?目前IE7的用户比例应该比较大,先不说别的浏览器了。
小弟用IE7测试了您的代码,可我的为什么还是不能全屏出来呢?

我想用<a>开始考试</a>来跳转到Exam.aspx考试页面,请问代码如何写?有空的话请帖详细代码。
小弟这几天时间为这个功能脑袋都大了,快短路了,谢谢大哥的帮忙...SOS
eugenepada 2009-07-07
  • 打赏
  • 举报
回复
quote:

Windows XP Service Pack 2 offered a number of security related
enhancements to Internet Explorer, this being one of them.

Users of Internet Explorer got sick of Web sites opening a window
fullscreen and "stealing" their desktop. In a lot of cases, people had no
idea how to rid themselves of the fullscreen page. Many Windows users do
not know about Alt+Tab and even those that do found themselves in a
situation where they could Alt+Tab away from the fullscreen IE window,
but when they returned to Internet Explorer, they found it occupying
their entire desktop again.

Of course, the simple solution to the problem is to bring the fullscreen
IE window into focus and hit Alt+F4 to close it - assuming the site
author hasn't written client-side JavaScript to intercept Alt+F4, which
I've also seen - however, the sequence of commands to close the
fullscreen window can be considered pretty complicated for a lot of
computer users, and I've seen people hit the reset button when presented
with a fullscreen IE window they could not figure out how to close.

To remove some user anxiety and make the Web a less hostile place,
Microsoft has wisely chosen to now display a title and status bar on
every newly opened window by default - the status bar (and perhaps the
titlebar) can be removed by the end-user if they so wish, but the Web
site author has no control over those settings.

Even if you have no malicious intent, the potential for mis-use remains,
and as a result, the functionality has been removed.
eugenepada 2009-07-07
  • 打赏
  • 举报
回复
好像fullscreen已经被IE Sp2给封锁了.....降低你浏览器的版本。。。
eugenepada 2009-07-07
  • 打赏
  • 举报
回复
不要在选项卡中打开新窗口,try,only IE

function MachakFull(url){
var x = screen.availWidth;
var y = screen.availHeight;
window.open(url, 'makeful', 'fullscreen=yes,channelmode=yes,titlebar=no,toolbar=no,scrollbars=auto,resizable=no,status=no,copyhistory=no,location=no,menubar=no,width='+x+',height='+y);
}

starsxingxing 2009-07-07
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 eugenepada 的回复:]
我的测试版本是IE 7.0.5730.11,测试结果是没有 标题栏(含最小化、最大化、关闭按钮)

你IE7的打开新窗口的不要选在新的选项卡中打开新窗口
[/Quote]

IE7 里的版本貌似都差不多,应该没什么区别。
我把弹出窗口的方式 以新窗口 方式弹出,效果还是有标题栏。
可我的为什么会还会有标题栏呢?

IE7 以新选项卡方式弹出是IE7的一个新特性之一,我相信还是会有很多用户采用此方式弹出的。
再次谢谢大哥的关注...
eugenepada 2009-07-07
  • 打赏
  • 举报
回复
我的测试版本是IE 7.0.5730.11,测试结果是没有 标题栏(含最小化、最大化、关闭按钮)

你IE7的打开新窗口的不要选在新的选项卡中打开新窗口
starsxingxing 2009-07-07
  • 打赏
  • 举报
回复
本来还想将我运行后的效果截个图上来,没想到该留言板不能直接上传图片,上传到相册还要申请,所以我就没有上传图片了。希望我上面给大哥您的回复能把运行后的效果说明白了。再次谢谢大哥了。
starsxingxing 2009-07-07
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 eugenepada 的回复:]
刚才在朋友的IE7下测了下,也是可以的

1.html

HTML code
<script>
function MachakFull(Ie,other){
x=screen.availWidth;
y=screen.availHeight;
target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length));
if((navigator.appVersion.indexOf("Mac")!=-1) &&(navigator.userAgent.indexOf("MSIE")!=-1) &&(parseInt(navigator.app…
[/Quote]

再次谢谢大哥您的耐心指导,我原封不动的复制您的代码运行后的结果如下:
页面的底部能遮住任务栏,但顶部还是留有标题栏(含最小化、最大化、关闭按钮)、当前页面路径。这和我之前做的效果一样,但它们还没有达到按F11的效果。您认为页面具有最小化、最大化、关闭按钮能够防止用户切换到桌面或其他地方去吗?这样做还没有达到防止作弊的效果了,也并非真正的全屏,(其实跟银行ATM提款机的界面效果相同)。
全屏后的页面只有一个 提交试卷 按钮。点击它后页面才能关闭(肯定也完成了考试的功能,我的所有试题都在一个页面里)。
希望高手们都来帮小弟一把...

dandande 2009-07-06
  • 打赏
  • 举报
回复
跟着学
starsxingxing 2009-07-06
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yejian520 的回复:]
<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…
[/Quote]

首先也谢谢大哥您的回答,但您的代码仍没有完全达到我想要的效果。
一:ActiveXObject控件,我之前在网上也看到过有大哥用它来回答其他兄弟页面全屏的问题。当初始化页面后需用户手动允许其运行,不是很人性化,最好能强制页面全屏。
二:手动运行其运行后,虽能全屏,但当鼠标移到页面最顶部时,还是会把标题栏之类的给显示出来。所以该控件还是不能完美的达到页面真正的完全全屏。

再次谢谢大哥您的解答...
starsxingxing 2009-07-06
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 prototyper 的回复:]
隐藏标题、地址、菜单栏就能不让人看到源码?客户端无密可保,SWF Encrypt加密过的Ascript人家还尝试从内存读取,前端JS在firefox和IE 8.0中暴露无遗,考试防作弊是传统考场的专利。
[/Quote]

谢谢大哥您的解答。也许您说的有道理。
但我将页面全屏的初衷是:不能让考生用鼠标切换到桌面或别的地方(之所以说类似于F11的效果,就是按F11可以达到全屏,但当鼠标移动到页面最顶部时,还是会将标题栏(里面有最小化、关闭按钮)之类的给弹出来,所以按F11的效果还是没有达到考试系统的要求),当然在试卷页面我还会要禁用掉部分键盘来达到此功能。
再次谢谢大哥您的关注...
starsxingxing 2009-07-06
  • 打赏
  • 举报
回复
各位,很抱歉,不知怎么了,该贴为什么被结贴了,我好像没有点结贴。迷惑中...
eugenepada 2009-07-06
  • 打赏
  • 举报
回复
别人写的,我在IE6下测了,是可以的


function MachakFull(Ie,other){
//Copyright ?1999 m.milicevic machakjoe@netscape.net jjooee@tip.nl
x=screen.availWidth;
y=screen.availHeight;
target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length));
if((navigator.appVersion.indexOf("Mac")!=-1) &&(navigator.userAgent.indexOf("MSIE")!=-1) &&(parseInt(navigator.appVersion)==4))
window.open(other,"sub",'scrollbars=yes');
if (target >= 4){
if (navigator.appName=="Netscape"){
var MachakFull=window.open(other,"MachakFull",'scrollbars=yes','width='+x+',height='+y+',top=0,left=0');
MachakFull.moveTo(0,0);
MachakFull.resizeTo(x,y);}
if (navigator.appName=="Microsoft Internet Explorer")
window.open(Ie,"MachakFull","fullscreen=yes");
}
else window.open(other,"sub",'scrollbars=yes');
}
yejian520 2009-07-06
  • 打赏
  • 举报
回复
<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>

安全要为低,还得是针对各各客户端,郁闷~~
starsxingxing 2009-07-06
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 starsxingxing 的回复:]
引用 8 楼 ZhaoHuiZiXin 的回复:
怎么复杂的功能才 20 分, 太少了。



呵呵,不好意思,我第二次进论坛提问,分数是默认给的。那我再加70分。总共给100分,虽然分不是很多,但希望大哥们能够帮帮忙,先谢谢了...
[/Quote]

嘿嘿,脑子短路了,居然算错了...是再加80分,总共100分
starsxingxing 2009-07-06
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 ZhaoHuiZiXin 的回复:]
怎么复杂的功能才 20 分, 太少了。
[/Quote]

呵呵,不好意思,我第二次进论坛提问,分数是默认给的。那我再加70分。总共给100分,虽然分不是很多,但希望大哥们能够帮帮忙,先谢谢了...
加载更多回复(3)

87,925

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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