1. The standard method
<script type="text/javascript">
function openWin(src, width, height, showScroll){
window.showModalDialog (src,"","location:No;status:No;help:No;dialogWidth:"+width+";dialogHeight:"+height+";scroll:"+showScroll+";");
}
</script>
Example: <span style= "Cursor:pointer" onclick= "Openwin
(' http://www.deepteach.com ', ' 500px ', ' 400px ', ' no ') ' > click </span>
2. It is to be noted that Firefox does not support this feature, it supports the syntax is
window.open
(’openwin.html’,'newWin’, 'modal=yes, width=200,height=200,resizable=no, scrollbars=no’ );
3. How to automatically judge the browser
<input type="button" value="打开对话框" onclick="showDialog('#')"/>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showDialog(url)
{
if( document.all ) //IE
{
feature="dialogWidth:300px;dialogHeight:200px;status:no;help:no";
window.showModalDialog(url,null,feature);
}
else
{
//modelessDialog可以将modal换成dialog=yes
feature ="width=300,height=200,menubar=no,toolbar=no,location=no,";
feature+="scrollbars=no,status=no,modal=yes";
window.open(url,null,feature);
}
}
//-->
</SCRIPT>
4. In IE, the modal dialog box hides the Address bar, while in other browsers it is not necessarily
"Note" In Google Browser, the effect of this mode will also be ineffective.