0

サイトマスター ページにボタンと iframe (src は、homepageaspx) があります。

そのボタンをクリックすると、iframe は別のページ (registeruseraspx) を正しく読み込みます。

この新しいページ (registeruseraspx) にボタンがあります。このボタンをクリックすると、iframe に新しい aspx ページが読み込まれます。

iframe の src 属性を registeruseraspx から動的に変更しようとしましたが、何も起こりません。

私を助けてください

4

1 に答える 1

0

iframe 内の iframe のページを置き換えるには (javascript を使用):

self.location.replace('your_new_page.aspx');

//add above javascript line to the onclick event of the button
//on registeruser.aspx page
<input id="myButton"
       type="button" 
       value="Iframe Button" 
       onclick="self.location.replace('your_new_page.aspx');" />

registeruser.aspx のコード ビハインド ページの使用:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
       myButton.Attributes.Add("onclick", "self.location.replace('your_new_page.aspx')");
    }
}
于 2013-09-20T16:19:44.777 に答える