waysun一路陽光

          不輕易服輸,不輕言放棄.--心是夢的舞臺,心有多大,舞臺有多大。踏踏實實做事,認認真真做人。

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
            167 隨筆 :: 1 文章 :: 64 評論 :: 0 Trackbacks
          轉自:http://tgyd2006.javaeye.com/blog/169887
          Window.Open()參數(shù):
          <SCRIPT LANGUAGE="javascript">
          <!--
          window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
          //寫成一行
          -->
          </SCRIPT>
          參數(shù)解釋:
          <SCRIPT LANGUAGE="javascript"> js腳本開始;
          window.open 彈出新窗口的命令;
          'page.html' 彈出窗口的文件名;
          'newwindow' 彈出窗口的名字(不是文件名),非必須,可用空''代替;
          height=100 窗口高度;
          width=400 窗口寬度;
          top=0 窗口距離屏幕上方的象素值;
          left=0 窗口距離屏幕左側的象素值;
          toolbar=no 是否顯示工具欄,yes為顯示;
          menubar,scrollbars 表示菜單欄和滾動欄。
          resizable=no 是否允許改變窗口大小,yes為允許;
          location=no 是否顯示地址欄,yes為允許;
          status=no 是否顯示狀態(tài)欄內的信息(通常是文件已經(jīng)打開),yes為允許;
          </SCRIPT>

          window.showModalDialog()參數(shù):
          JavaScript:window.showModalDialog('Ori_Photo.aspx','','resizable:yes;scroll:yes;status:no;dialogWidth=320px;dialogHeight=230px;center=yes;help=no');


          window.showModalDialog(URL,dialogArgments.features) 打開一個新窗口

          URL為要開啟的網(wǎng)頁名字。
          dialogArgments為設定好傳遞給新視窗網(wǎng)頁的參數(shù),可以為任意數(shù)據(jù)類型。
          feature 與open()的類似,都是格式方面的設定。調用格式為featureName1:featureValue1:(分號)featureName2:featureValue2:

          關于feature具體的參數(shù)我就不詳細寫了,看名字就應該知道什么用處了吧。
          certer , dialogHeight, dialogLeft,dialogTop,dialogWidth,help(是否顯示help按鈕,下同),status,resizeable
          值=1為yes,0為no.

          我認為最重要的是dialogArgments,可以傳遞值到新的窗口。
          第二重要就是 它的返回值 window.returnValue.可以在showModalDialog開啟的窗口關閉后前,回傳一個任意類型的值。




          基本介紹:
          showModalDialog() (IE 4+ 支持)
          showModelessDialog() (IE 5+ 支持)
          window.showModalDialog()方法用來創(chuàng)建一個顯示HTML內容的模態(tài)對話框。
          window.showModelessDialog()方法用來創(chuàng)建一個顯示HTML內容的非模態(tài)對話框。

          使用方法:
          vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
          vReturnValue = window.showModelessDialog(sURL [, vArguments] [,sFeatures])

          參數(shù)說明:
          sURL--必選參數(shù),類型:字符串。用來指定對話框要顯示的文檔的URL。
          vArguments--可選參數(shù),類型:變體。用來向對話框傳遞參數(shù)。傳遞的參數(shù)類型不限,包括數(shù)組等。對話框通過window.dialogArguments來取得傳遞進來的參數(shù)。
          sFeatures--可選參數(shù),類型:字符串。用來描述對話框的外觀等信息,可以使用以下的一個或幾個,用分號“;”隔開。
          1.dialogHeight :對話框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默認的單位是em,而IE5中是px,為方便其見,在定義modal方式的對話框時,用px做單位。
          2.dialogWidth: 對話框寬度。
          3.dialogLeft: 離屏幕左的距離。
          4.dialogTop: 離屏幕上的距離。
          5.center: {yes | no | 1 | 0 }:窗口是否居中,默認yes,但仍可以指定高度和寬度。
          6.help: {yes | no | 1 | 0 }:是否顯示幫助按鈕,默認yes。
          7.resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改變大小。默認no。
          8.status: {yes | no | 1 | 0 } [IE5+]:是否顯示狀態(tài)欄。默認為yes[ Modeless]或no[Modal]。
          9.scroll:{ yes | no | 1 | 0 | on | off }:指明對話框是否顯示滾動條。默認為yes。
          下面幾個屬性是用在HTA中的,在一般的網(wǎng)頁中一般不使用。
          10.dialogHide:{ yes | no | 1 | 0 | on | off }:在打印或者打印預覽時對話框是否隱藏。默認為no。
          11.edge:{ sunken | raised }:指明對話框的邊框樣式。默認為raised。
          12.unadorned:{ yes | no | 1 | 0 | on | off }:默認為no。

          參數(shù)傳遞:
          1.要想對話框傳遞參數(shù),是通過vArguments來進行傳遞的。類型不限制,對于字符串類型,最大為4096個字符。也可以傳遞對象,例如:
          parent.htm
          代碼運行框:
          <script>
          var obj = new Object();
          obj.name="51js";
          window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px");
          </script>
          modal.htm
          <script>
          var obj = window.dialogArguments
          alert("您傳遞的參數(shù)為:" + obj.name)
          </script>

          [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]
          2.可以通過window.returnValue向打開對話框的窗口返回信息,當然也可以是對象。例如:
          代碼運行框:
          <script>
          str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");
          alert(str);
          </script>
          modal.htm
          <script>
          window.returnValue="/";
          </script>
          posted on 2008-08-05 14:58 weesun一米陽光 閱讀(1601) 評論(0)  編輯  收藏 所屬分類: AJAX總結備用
          主站蜘蛛池模板: 天镇县| 河间市| 茶陵县| 金塔县| 兴和县| 克什克腾旗| 中西区| 阜阳市| 平湖市| 上杭县| 宿州市| 宁国市| 长乐市| 台安县| 横山县| 思南县| 台州市| 疏勒县| 哈尔滨市| 汽车| 新郑市| 柏乡县| 遂昌县| 达孜县| 开化县| 洛隆县| 高雄市| 信宜市| 汉中市| 庄浪县| 海林市| 福州市| 忻城县| 英德市| 营山县| 大渡口区| 安康市| 砚山县| 岳阳市| 安远县| 阳城县|