• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • javascript全屏幕顯示的問題

    發表于:2007-06-21來源:作者:點擊數: 標簽:
    返回某個固定頁面: function bk(strUrl) { window.location.href=strUrl } bk("A.jsp") 打開頁面就全屏顯示 SCRIPT LANGUAGE="JavaScript" !-- Begin if (this.name!='fullscreen'){ window.open(location.href,'fullscreen','fullscreen,scrollbars') } //

       

    返回某個固定頁面:
    function bk(strUrl)
    {
    window.location.href=strUrl
    }


    bk("A.jsp")



    打開頁面就全屏顯示
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    if (this.name!='fullscreen'){
      window.open(location.href,'fullscreen','fullscreen,scrollbars')
    }
    //  End -->
    </script>
    <a href="JavaScript:window.close(self)">返回正常效果顯示</a>
    <script LANGUAGE="JavaScript">
    <!--


    window.open ("URL(如http://www.webjx.com)", "(窗口名稱)123", "height=170, width=300, toolbar=no,menubar=no, scrollbars=no, resizable=no, location=no, status=no, top=100") ;


    //-->
    </script>


    注:
    url代表彈出窗口的地址
    height代表彈出窗口的高度
    width代表彈出窗口的寬度
    toolbar代表工具欄,no表示沒有工具欄,yes為有工具欄
    menubar代表菜單欄,no表示不顯示菜單,用戶也可以用yes
    scrollbars代表滾動條,no表示沒有滾動條,yes為有滾動條,也可以用auto
    resizable代表是否可以縮放彈出窗口
    location代表地址欄
    status代表關態欄
    top代表窗口距瀏覽器上部的距離



    JavaScript:完全容錯和瀏覽器自動最大化   
     
    錯誤代碼的即時處理
    我們編制的JavaScript代碼有時會由于我們的疏忽而存在一些錯誤,以至于用戶
    瀏覽時會彈出令人生厭的錯誤提示框架,如何處理這種情況呢?下面介紹兩種常
    見方法:



    (1) 完全容錯


    即用戶瀏覽含有錯誤代碼的頁面時,忽視所有的錯誤。代碼如下:
    ;


    〈script〉


    function killerr() {


    return true


    }


    window.onerror=killerr


    〈/script〉


    它雖然能掩蓋錯誤,避免彈出錯誤提示框,但程序仍未正確執行,下面介紹另一
    處理方法。


    (2) 反饋錯誤信息


    即當出現錯誤代碼時,自動彈出我們預先設計好的反饋窗口,目的是用戶只需簡
    單地按一下鼠標就可以把反饋信息發到你指定的信箱,當然反饋窗口的內容我們
    可以任意修改設計。代碼如下:


    〈script〉


    function errorinfo()


    {


    errorwin=window.open(″ ″,″ ″,″width=20,height=120″)


    errorwin.document.write(′〈title〉腳本錯誤報告〈/title〉〈center〉該頁
    面發現了腳本運行錯誤,請〈a href=″mailto:lhy@cenpok.net″〉通知〈/a〉
    管理員?!碽r〉〈form〉〈input type=″button″ value=″關閉窗口″ onCli
    ck=″window.close()″〉〈/form〉〈/center〉′)


    errorwin.document.close()


    errorwin.document.bgColor=″#ffffff″


    return true


    }


    window.onerror=errorinfo


    〈/script〉


    優化瀏覽窗口


    使用這段代碼,當用戶打開你的頁面時,瀏覽器窗口會自動擴展到最大可利用空間
    (非全屏),豈不是很專業?


    以下代碼放在〈head〉〈/head〉之間:


    〈script language=″JavaScript″〉


    〈!--function winfix() {


    if (document.layers) {


    width=screen.availWidth-10;


    height=screen.availHeight-20;


    } else {


    var width=screen.availWidth-2;


    var height=screen.availHeight;


    }


    self.resizeTo(width, height);


    self.moveTo(0, 0);


    }


    //--〉


    〈/script〉


    以下代碼放在〈body〉Tag里:


    〈body onload=″winfix()″〉
     
     



    <script language="javascript">
    //Resize_Window
    if ((screen.width == 1024) && (screen.height == 768)){
    Resize_WindowX = 1024;
    Resize_WindowY = 768;
    self.resizeTo(Resize_WindowX,Resize_WindowY);//Resize_WindowEnd
    }
    else  ((screen.width > 1024) && (screen.height > 1000)){
    document.body.clientWidth = 1280;
    document.body.clientHeight = 1024;
    self.resizeTo(document.body.clientWidth,document.body.clientHeight);//Resize_WindowEnd
    }
    document.body.clientWidth; document.body.clientHeight


    </script>


    <script language="javascript">
    <!-- Begin
    if ((screen.width == 640) && (screen.height == 480)){
    self.location.href='640*480.htm'
    }
    else if ((screen.width == 800) && (screen.height == 600)){
    self.location.href='800*600.htm'
    }
    else if ((screen.width == 1024) && (screen.height == 768)){
    self.location.href='1024*768.htm'
    }
    else {self.location.href='else.htm'
    }
    // End -->
    </script>



      用window.openr打開的子父窗口之間的操作跟框架的是不一樣的,子窗口和父窗口之間有opener來聯系。而源窗口要訪問子窗口要通過其句柄來操作。以下小例子希望能幫助新手更了解他們的操作。


    test.htm  


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>子父窗口的操作</title>
    </head>
    <body>
    <script>
    var win=null;
    function op(){
    win=window.open("about:blank","win","width=200,height=200");
    win.document.write("<input type='button' value='關閉父窗口' onclick='window.opener.opener=null;window.opener.close()'>");
    win.document.write("<input type='button' value='刷新你窗口' onclick='window.opener.location.reload()'>");
    }
    </script>
    <input onclick="op()" value="打開窗口" type="button"><input type="button" value="最小化" onclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else alert('還沒有打開窗口或已經關閉')"><input type="button" value="最大化" onclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else alert('還沒有打開窗口或已經關閉');"><input type=button value="關閉子窗口" onclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else alert('還沒有打開窗口或已關閉')"><input type=button value="刷新子窗口" onclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else alert('窗口還沒有打開或已關閉')"><input type="button" value="看子窗口的大小" onclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('還沒有打開窗口或者已關閉')};">
    </body>
    </html>



    網頁顯示一定時間自動關閉



    <script id=clientEventHandlersJS language=javascript>
     window.opener = null;
    </script>


    <body bgcolor="#fef4d9" onLoad="setTimeout(window.close, 5000)">



    <html>
    <head
    <title>123</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script>
    <!--
    function omiga_window(){
    window.open("full_window.htm","","fullscreen,scrollbars")
    }
    //-->
    </script>
    </head>


    <body onload="omiga_window()" onblur="focus();closes.Click();" scroll="no">
    <object id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <param name="Command" value="Close">
    </object>
    <p> </p>
    <p> </p>


    全屏!


    </body>
    </html>



    <script language=″JavaScript″〉


    〈!--function winfix() {


    if (document.layers) {


    width=screen.availWidth-10;


    height=screen.availHeight-20;


    } else {


    var width=screen.availWidth-2;


    var height=screen.availHeight;


    }


    self.resizeTo(width, height);


    self.moveTo(0, 0);


    }


    //--〉


    〈/script〉

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>