javascript当中showModalDialog的用法

马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。



例 1.7.1(showModalDialogOIEFF.html)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<SCRIPT LANGUAGE="JavaScript">
<!--

function choice()
{  
/* 马克-to-win:showModalDialog will get back window.returnValue from second.html, 要注意两个window传递参数的方法*/
    var v = showModalDialog("secondoR.html");
    document.getElementById("cla").value=v;
}
//-->
</SCRIPT>
</HEAD>

<BODY>
演示时,直接点击button
<INPUT TYPE="text" id="cla"><INPUT TYPE="button" value="点击" onclick="choice()" >
</BODY>
</HTML>





secondoR.html



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

 <BODY>
  <!--opener is showModalDialogo.html-->
  <form name="fq">
    <select>
      <option value=0801java>0801java</option>
      <option value=0802java>0802java</option>
      <option value=0803java>0803java</option>
  </select>
    <button name="b1" onclick="window.returnValue=window.fq.elements[0].value;window.close();">close</button>  
  </form>
 </BODY>
</HTML>