🎶 Sym - 一款用 Java 实现的现代化社区(论坛/BBS/社交网络/博客)平台

📕 思源笔记 - 一款桌面端笔记应用,支持 Windows、Mac 和 Linux

🎸 Solo - B3log 分布式社区的博客端节点,欢迎加入下一代社区网络

♏ Vditor - 一款浏览器端的 Markdown 编辑器

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

    </div>
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 .

欢迎注册黑客派社区,开启你的博客之旅。让学习和分享成为一种习惯!

推荐阅读
留下你的脚步