前提・実現したいこと
JacaScriptでwindow.openを使い、子ウィンドウを開き、親ウィンドウの変数をリアルタイムで子ウィンドウに渡したいです。
具体的な内容としては親ウィンドウのbuttonなどである変数を更新し、子ウィンドウでその変数を文字列として表示させるというもの
使用ブラウザはChrome
発生している問題・エラーメッセージ
windowは開くが変数が渡されない
### 該当のソースコード <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>main</title> </head> <body> <p><a href="javascript:Open();">サブウィンドウを開く</a></p> <p><a href="javascript:Write();">書き換え</a></p> </body> <style> </style> <script> function Open() { var win = window.open('test.html','sub1','width=400px,height=600px'); var waitlimit = (new Date()).getTime() + 5000; while((new Date()).getTime() < waitlimit) { try { if(win && win.document && win.document.body && win.document.getElementById) { break; } } catch(e) { } } } function Write() { win.document.getElementById('test').value = "test"; } </script> </html>vaScript
試したこと
以下のコードでは渡せたがリアルタイムで更新はできなかった
```var v = 'test'; window.open("test.html?"+v ,"sub1", "width=400, height=600");
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。