JS常用程式碼片段截取(二)

來源:互聯網
上載者:User

6.視窗彈出在不同瀏覽器下的實現
if ($.browser.msie) {
        window.showModalDialog(openUrl, argumentObj, size+"scroll:no;");
    } else {
        var win = window.open(openUrl,"",
            size + "scrollbars=no, dialog=yes, modal=yes, toolbar=no, menubar=no, resizable=no, location=no, status=no");
        win.focus();
    }

7.彈出一個子類視窗,將子類視窗的參數傳給父類視窗實現(FF & IE)
if ($.browser.msie) {
        window_value = window.dialogArguments.argumentObj.windowId;
        channel_value = window.dialogArguments.argumentObj.channel;
    } else {
        window_value = window.opener.windowId;
        channel_value = window.opener.channel;
    }

8.超級噁心的IE 居然不支援 css 選取器,還好JQuery 秒秒鐘就可以搞定
$("input").each(function(){
                        if($(this).attr("type")=="checkbox" || $(this).attr("type")=="radio"){
                            $(this).addClass("MP");
                        }
                    });

9.showModalDialog Method

Creates a modal dialog box that displays the specified HTML document.

Syntax

vReturnValue
= object

.showModalDialog(
sURL
[
,
vArguments
]
[
,
sFeatures
]
)

Parameters

sURL Required.
String
 that specifies the URL of the document to load and display.
vArguments Optional.
Variant
that specifies the arguments to use when displaying the document. Use
this parameter to pass a value of any type, including an array of
values. The dialog box can extract the values passed by the caller from
the
dialogArguments
property of the
window
object.
sFeatures Optional.
String
 that specifies the window ornaments for the dialog box, using one or more of the following semicolon-delimited values: dialogHeight:sHeight
Sets the height of the dialog window (see Remarks for default unit of measure).dialogLeft:sXPos
Sets the left position of the dialog window relative to the upper-left corner of the desktop.dialogTop:sYPos
Sets the top position of the dialog window relative to the upper-left corner of the desktop.dialogWidth:sWidth
Sets the width of the dialog window (see Remarks for default unit of measure).center:{ yes | no | 1 | 0 | on | off }
Specifies whether to center the dialog window within the desktop. The default is yes
.dialogHide:{ yes | no | 1 | 0 | on | off }
Specifies
whether the dialog window is hidden when printing or using print
preview. This feature is only available when a dialog box is opened
from a trusted application. The default is no
.edge:{ sunken | raised }
Specifies the edge style of the dialog window. The default is raised
.resizable:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window has fixed dimensions. The default is no
.scroll:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window displays scrollbars. The default is yes
.status:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window displays a status bar. The default is yes
for untrusted dialog windows and no
for trusted dialog windows.unadorned:{ yes | no | 1 | 0 | on | off }
Specifies
whether the dialog window displays the border window chrome. This
feature is only available when a dialog box is opened from a trusted
application. The default is no
.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.