0

現在、子ウィンドウでスクリプトを使用して、親ウィンドウに配置された asp ボタン hdnbtnrefresh にアクセスしています

var btn = top.opener.document.getElementById("hdnbtnrefresh");

しかし、それはnullを返します

4

2 に答える 2

0

ID付きのjqueryセレクターを直接使用しないのはなぜですか:

$("#hdnbtnrefresh")

親ノードについては、parent() で遊ぶことができます

$("#hdnbtnrefresh").parent()

ドキュメントはこちら: http://api.jquery.com/parent/

他の方法:

$('#hdnbtnrefresh', window.parent.document).html();
于 2012-11-02T10:37:36.577 に答える