Javascript 如何在asp.net中获取iframe onload事件
我正在使用Reportviewer在.aspx页面上查看SSRS报告。 因为此reportviewer在浏览器中呈现为iframe。 我想在每次加载iframe时调用一些javascript函数Javascript 如何在asp.net中获取iframe onload事件,javascript,asp.net,reportviewer2008,Javascript,Asp.net,Reportviewer2008,我正在使用Reportviewer在.aspx页面上查看SSRS报告。 因为此reportviewer在浏览器中呈现为iframe。 我想在每次加载iframe时调用一些javascript函数 I can't use window.onload because the content of reportviewer that is iframes get changed without any postback. 我不确定这是否有用,因为我从未使用过ReportViewer,但如果您可以访
I can't use window.onload because the content of reportviewer that is iframes get changed without any postback.
我不确定这是否有用,因为我从未使用过ReportViewer,但如果您可以访问服务器端页面,请执行以下操作:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainIFrame.Attributes.Add("onload", "MainIFrame_OnLoad();");
}
}
function MainIFrame_OnLoad() {
alert('yes!');
}
在javascript文件上添加以下内容:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainIFrame.Attributes.Add("onload", "MainIFrame_OnLoad();");
}
}
function MainIFrame_OnLoad() {
alert('yes!');
}
我不确定这是否有用,因为我从未使用过ReportViewer,但如果您可以访问服务器端页面,请执行以下操作:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainIFrame.Attributes.Add("onload", "MainIFrame_OnLoad();");
}
}
function MainIFrame_OnLoad() {
alert('yes!');
}
在javascript文件上添加以下内容:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
MainIFrame.Attributes.Add("onload", "MainIFrame_OnLoad();");
}
}
function MainIFrame_OnLoad() {
alert('yes!');
}