大虾们好,小弟又要向各位请教个问题了。
小弟现在遇到了个网上已问过很多、回答次数也很多的问题。
网上提到过:瞒天过海法-javascript:window.open("12.htm","","fullscreen=1,menubar=0,toolbar=0,directories=0,location=0,   
  status=0,scrollbars=0")、借尸还魂法、返璞归真法。
均没有达到页面完全全屏的效果。可能是小弟理解能力差,嘿嘿。
小弟现在做的是考试系统,根据其需求要把 试卷页面全屏化,防止作弊。
与按F11的效果类似,但与其不同的是:按F11时,当鼠标移动到页面顶部时,会将标题、地址、菜单栏之类的都给弹出来,而我不需将它们弹出来。请问需怎么设置才能到达该效果?

解决方案 »

  1.   

    隐藏标题、地址、菜单栏就能不让人看到源码?客户端无密可保,SWF Encrypt加密过的Ascript人家还尝试从内存读取,前端JS在firefox和IE 8.0中暴露无遗,考试防作弊是传统考场的专利。
      

  2.   

    <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>
     
    安全要为低,还得是针对各各客户端,郁闷~~
      

  3.   


    谢谢大哥您的解答。也许您说的有道理。
    但我将页面全屏的初衷是:不能让考生用鼠标切换到桌面或别的地方(之所以说类似于F11的效果,就是按F11可以达到全屏,但当鼠标移动到页面最顶部时,还是会将标题栏(里面有最小化、关闭按钮)之类的给弹出来,所以按F11的效果还是没有达到考试系统的要求),当然在试卷页面我还会要禁用掉部分键盘来达到此功能。
    再次谢谢大哥您的关注...
      

  4.   


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

  5.   

    别人写的,我在IE6下测了,是可以的
    function MachakFull(Ie,other){
    //Copyright ?1999 m.milicevic [email protected] [email protected]
    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');
    }
      

  6.   


    eugenepada大哥,谢谢您的解答。
    小弟有些不解:function MachakFull(Ie,other)的两个参数应该是需要全屏的页面的路径,为什么要用两个不同的参数呢?
    还有就是,如果客户端是IE7呢?可以达到全屏吗?目前IE7的用户比例应该比较大,先不说别的浏览器了。
    小弟用IE7测试了您的代码,可我的为什么还是不能全屏出来呢?我想用<a>开始考试</a>来跳转到Exam.aspx考试页面,请问代码如何写?有空的话请帖详细代码。
    小弟这几天时间为这个功能脑袋都大了,快短路了,谢谢大哥的帮忙...SOS
      

  7.   

    刚才在朋友的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>
      

  8.   


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

  9.   

    我的测试版本是IE 7.0.5730.11,测试结果是没有  标题栏(含最小化、最大化、关闭按钮)你IE7的打开新窗口的不要选在新的选项卡中打开新窗口
      

  10.   


    IE7 里的版本貌似都差不多,应该没什么区别。
    我把弹出窗口的方式 以新窗口 方式弹出,效果还是有标题栏。
    可我的为什么会还会有标题栏呢?IE7 以新选项卡方式弹出是IE7的一个新特性之一,我相信还是会有很多用户采用此方式弹出的。
    再次谢谢大哥的关注...
      

  11.   

    不要在选项卡中打开新窗口,try,only IEfunction 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);
    }
      

  12.   

    好像fullscreen已经被IE Sp2给封锁了.....降低你浏览器的版本
      

  13.   

    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.
      

  14.   


    首先,想说声抱歉,上星期忙别的事去,隔了这么久才回复大哥您的解答。
    虽然没有从根本上解决问题,但还是谢谢大哥,同时也把分给您。辛苦了。我想要实现页面完全全屏,在sp2和IE7下用js可能实现不了。
    估计是要写个什么插件,我以前看过一个网络考试系统,在sp2和IE7下可以实现全屏。
    同时把该网址晒出来:http://test.xuancai.com/TestSite/Login.aspx
    但是用户名和密码是一次性的,呵呵
      

  15.   

    昨晚研究了很晚,我的结论是:楼主一直是在强调没有达到全屏效果,但很多网友说已经在IE7中测试通过,其实你们说的都对,当你的页面是以单独一个放在硬盘的html文件单独打开时,打开效果非常好,当置于web项目时:http://localhost/exam/test.html时,该页面的全屏效果是不太满意的,这就是楼主一直不满的原因。谁能接着研究?
      

  16.   

    这个代码,我在IE6和IE8下都测了,都有效果啊,IE7我这没有