JS常用代碼片段截取(二)



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.Variantthat specifies the arguments to use when displaying the document. Usethis parameter to pass a value of any type, including an array ofvalues. The dialog box can extract the values passed by the caller fromthe 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:sHeightSets the height of the dialog window (see Remarks for default unit of measure).dialogLeft:sXPosSets the left position of the dialog window relative to the upper-left corner of the desktop.dialogTop:sYPosSets the top position of the dialog window relative to the upper-left corner of the desktop.dialogWidth:sWidthSets 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 }Specifieswhether the dialog window is hidden when printing or using printpreview. This feature is only available when a dialog box is openedfrom 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 }Specifieswhether the dialog window displays the border window chrome. Thisfeature is only available when a dialog box is opened from a trustedapplication. The default is no.

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
  © 2014-2022 ITdaan.com 联系我们: