[RESOLVED] iFrame problem
Hi,
I want to have a button in my iframe page which when clicked changes the parent page's webpage. If i had a hyperlink in my iframe this would be easily done by:
Code:
<a href="changePage.html" target="_parent">
The button control doesn't have a target property. I guess i will have to do this using javascript. Can anyone help me out on this code.
Thanks.
Re: [RESOLVED] iFrame problem
Kewl...glad I could help ;)
Just so you no you probably don't need:
Code:
javascript:window.open('myWebpage.aspx', '_parent');
As the line :
Code:
window.open('myWebpage.aspx', '_parent');
Should do the same job where as the line before. Also the line before may give a JS error in some browsers, but if you find it works ok then wouldn't worry about it too much, If you also want to make it a bit more browser friendly use:
Code:
protected void btn_Checkout_Click(object sender, EventArgs e)
{
//Do some stuff here
Session["total"] = NewPrice;
string runJavascript = "<script type='text/javascript' language='javascript'>";
runJavascript += "<!--"
runJavascript += "window.open('myWebpage.aspx', '_parent');";
runJavascript += "//-->"
runJavascript += "<" + "/script>";
Page.RegisterStartupScript("openPageInParent", runJavascript);
}
:thumb:
Re: [RESOLVED] iFrame problem
Re: [RESOLVED] iFrame problem
np's just happy to help ;)