window.returnValue 和showModalDialog实现弹出有模式窗体

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>


<script language="javascript" type="text/javascript">
function ss(theURL,winName,theW,theH)
{
     var theTop = (window.screen.height-theH)/2;
         var theLeft = (window.screen.width-theW)/2;
var features = "dialogWidth="+theW+"px;dialogHeight="+theH+"px;status=0;help=0;dialogLeft="+theLeft+"px;dialogTop="+theTop+"px;";
         var str =window.showModalDialog(theURL,winName,features);

if(str=="ok")
{
             alert(str+"------------222");
}
}
</script>
</head>

<body>
<center>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
111111111111<input type="button" value="SPSS分析" onclick="javascript:ss('modal.html','eryuan SPSS分析结',300,60)"/>

</center>
</body>
</html>








<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
       function returnValues()
   {
           window.returnValue=document.getElementById("msg").value;
   window.close();
   }
  
   function closes()
   {
   window.returnValue="close";
   window.close();
   }
  
</script>

</head>

<body>
<center>
<div>SPSS已分析完成.</div>
<input type="button" value="yes" onclick="javascript:returnValues()"/>
<input type="button" value="no" onclick="javascript:closes()"/>
<div>
            <input type="hidden" name="msg" id="msg" value="ok"/>
</div>
</center>
</body>
</html>

你可能感兴趣的:(html,XHTML)