我的 IFrame 有问题

2023-12-30

hai ,

我有一个 iFrame 用于在我的页面中显示动态页面。

 <iframe id="divIFrame" scrolling="no" runat ="server"  src="Login.aspx"  frameborder="0"
       style="width: 575px; height:323px; padding:0px;z-index:0px;" >
 </iframe>  

在后面的代码中,我使用一行代码将“src”属性添加到 iframe。

 divIFrame.Attributes("src") = "..\Pages\Company.aspx"

它可以在 IE a 和 chrome 中工作,但不能在 Mozilla firefox 中工作。它显示这样的错误

Server Error in '/' Application.
HTTP Error 400 - Bad Request.
Version Information: ASP.NET Development Server 9.0.0.0 

请帮忙。


您需要在 URL 中使用正斜杠 / 而不是反斜杠 \。

 divIFrame.Attributes("src") = "../Pages/Company.aspx"

Internet Explorer 正在悄悄地为您转换斜杠,从而掩盖问题。 Firefox 正确地没有。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我的 IFrame 有问题 的相关文章

随机推荐