xzknet 发表于 2013-2-7 15:07:53

showModalDialog以及IE7 对话框样式

window.showModalDialog(URL,dialogArgments.features) 打开一个新窗口

URL为要开启的网页名字。
dialogArgments为设定好传递给新视窗网页的参数,可以为任意数据类型。
feature 与open()的类似,都是格式方面的设定。调用格式为featureName1:featureValue1:(分号)featureName2:featureValue2:

关于feature具体的参数我就不详细写了,看名字就应该知道什么用处了吧。
certer , dialogHeight, dialogLeft,dialogTop,dialogWidth,help(是否显示help按钮,下同),status,resizeable
值=1为yes,0为no.

我认为最重要的是dialogArgments,可以传递值到新的窗口。
第二重要就是 它的返回值 window.returnValue.可以在showModalDialog开启的窗口关闭后前,回传一个任意类型的值。
使用示例:
<div style="padding-right: 5.4pt; padding-left: 5.4pt; background: #e6e6e6; padding-bottom: 4px; width: 95%; padding-top: 4px;">http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif<script language="javascript">...
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.giffunction show()...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif    var sRet = window.showModalDialog('a.html','title','scrollbars=no;resizable=no;help=no;status=no;dialogTop=25; dialogLeft=0;dialogHeight=350px;dialogwidth=410px;');
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif        if(sRet == "refresh") 
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif        ...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif            window.location.reload();
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif        }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif        
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif}
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif</script>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif<input name="" type="button" onClick="show();" value="打开" />
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif<script language="javascript">...
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif    function al()...{
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif        alert("关闭了哦");
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif        window.returnValue = "refresh";
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif        window.close();
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif    }
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif</script>
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif<input name="" type="button" onClick="al();" value="关闭" />
页: [1]
查看完整版本: showModalDialog以及IE7 对话框样式