JavaScript

 モーダルダイアログは、子ウィンドウの表示中、親ウィンドウの操作は一切禁止されるウィンドウのことを指します。モーダルダイアログを表示するに showModalDialog() を使用します。下は利用サンプルです。

<script type="text/javascript">
<!--
function func() {
 var args = new Array();
 args[0] = window;
 args[1] = document.f1.t1.value;
 args[2] = document.f1.t2.value;
 val = showModalDialog("test2.htm", args,
     "dialogHeight:100px;dialogWidth:300px");
}
// -->
</script>

<form name="f1">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="button" value="OK" onclick="func()">
</form> 

表示されるダイアログの内容も HTML で記述します。dialogArguments で親ウィンドウからの値を取得することができます。また、returnValue で親ウィンドウに値を返すことができます。

<html>
<head>
<title>モーダルダイアログ</title>
<script type="text/javascript">
<!--
var win;
function init() {
  win = window.dialogArguments[0];
 document.f2.t1.value = window.dialogArguments[1];
 document.f2.t2.value = window.dialogArguments[2];
}
function OnOK() {
 win.document.f1.t1.value = document.f2.t1.value;
 win.document.f1.t2.value = document.f2.t2.value;
 window.returnValue = true;
 window.close();
}
// -->
</script>
</head>
<body onload="init()">
<form name="f2">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="button" value="OK" onclick="OnOK()">
</form>
</body>
</html>


ウィジェット型CM動画配信サービス manna [マナ]

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結解除 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:34:29 (1628d)

yVoC[UNLIMITȂ1~] ECirŃ|C Yahoo yV LINEf[^[Ōz500~`I


z[y[W ̃NWbgJ[h COiq 萔O~ył񂫁z COsیI COze