0

(window.open)コマンドで新しいウィンドウを開くことができるaspxファイルを用意しました。子ウィンドウでは、いくつかの値が (.innerHTML) コマンドで親ページに送信され、それ自体を閉じることができます。ただし、マスターページを親ページに設定した後、コマンドは新しいウィンドウから親に値を送信できず、それ自体を閉じることができません。

マスターページは JavaScript コマンドにどのように影響しますか?
ありがとう


編集: drachensternによる(私は自分が持っているものでできることをします...これは彼が貼り付けたものです)

子コード ビハインドから:

<br> Page.RegisterStartupScript("CLOSE",
  "<...JS...><script type=\"text/javascript\">" +<br>
  "window.opener.document.getElementById('TableID').innerHTML = \"" + RadioNumber + "\";" +<br>
"window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\";  
<br>
self.close();" +
"<...JS....></script>"
);<br>

親側:

<br>
..a ..<br>href="javascript:window.open('SelectTable.aspx','OPEN','toolbar=no,directories=no,status=no,titlebar=no,menubar=no,scrollbars=no,resizable=no,width=800,height=600,top=0,left=0,');"/>SelectSomthng<br>../a..

2番目の編集:(再びdrachenstern) これが意図であるように見えます

子コード ビハインドから:

Page.RegisterStartupScript("CLOSE",
  "<...JS...><script type=\"text/javascript\">" +
  "window.opener.document.getElementById('TableID').innerHTML = \""   + RadioNumber + "\";" +
  "window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\"; +
  self.close();" + "<...JS....></script>");

親側:

/* drachenstern: notice I put the carriage returns for legibility, not in the original code*/
<a href="javascript:window.open(
'SelectTable.aspx',
'OPEN',
'toolbar=no,directories=no,status=no,titlebar=no,menubar=no,
scrollbars=no,resizable=no,width=800,height=600,top=0,left=0,'
);"/>SelectSomthng</a>
4

2 に答える 2

1

子ウィンドウで親ページのコントロールを取得し、親ページにマスターページを使用する場合は、次を使用して、TagNameを使用して入力タイプまたはその他のタイプのコントロールを取得できます。

var collection=window.opener.document.body.getElementsByTagName('input')

alert(collection[o].id);  
alert(collection[1].id);
alert(collection[2].id);..... ext

コレクションをトラバースして、メソッドで必要なIDを見つけ、indexOf()必要なことを実行できます。

于 2011-02-28T18:32:30.177 に答える
0

子コード ビハインドから:
Page.RegisterStartupScript("CLOSE", "<...JS...>" +
"window.opener.document.getElementById('TableID').innerHTML = \"" + RadioNumber + "\" ;" +
"window.opener.document.getElementById('HiddenTableID').value = \"" + RadioNumber + "\";" +
"self.close();" + "<...JS.... >" );

親側:
..a ..
href="javascript:window.open('SelectTable.aspx','OPEN','toolbar=no,directories=no,status=no,titlebar=no, menubar=no,scrollbars= no,resizable=no,width=800,height=600,top=0,left=0,');"/>SelectSomthng
../a..

于 2010-12-01T21:47:52.557 に答える