javascript当中showModalDialog的用法

7.showModalDialog

例 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="点击" οnclick="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" οnclick="window.returnValue=window.fq.elements[0].value;window.close();">close</button>    
  </form>
 </BODY>
</HTML>

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_43650923/article/details/103046080

posted @ 2021-11-29 19:58  malala  阅读(19)  评论(0编辑  收藏  举报