如何在Iframe中重定向页面? [英] How to redirect page in Iframe?

查看:2686
本文介绍了如何在Iframe中重定向页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net应用程序中,我有iframe,我必须在其中打开新网站,因为这个页面必须重定向,如何在iframe中重定向页面???

In my asp.net application, I have Iframe in which i have to open new websites, for this page must redirect, how to redirect the page in Iframe???

推荐答案

检查下面的链接,它应该让你公平地了解如何更改src:



现场演示: http://jsfiddle.net/GeekyJohn/GH5QG/

帮助链接:

http://www.sitepoint.com/forums/showthread.php?818497-Changing-and-loading-an-iframe-src-attribute-with-jQuery

http://stackoverflow.com/questions/86428/whats-the -best-way-to-reload-an-iframe-using-javascript
Check below links, it should give you fair idea of how to change the src:

Live Demo:http://jsfiddle.net/GeekyJohn/GH5QG/
HelpLinks:
http://www.sitepoint.com/forums/showthread.php?818497-Changing-and-loading-an-iframe-src-attribute-with-jQuery
http://stackoverflow.com/questions/86428/whats-the-best-way-to-reload-an-iframe-using-javascript




请找代码,

Hi,
Please find the code,
<html><head>
<title>Test IFrame SRC by Javascript </title>

<script>
function RedirectPage()
{
 document.getElementById("frame1").src = "http://WWW.microsoft.com";
}
</script>
</head>
<body>
<table>
<tr>
<td>
     <iframe name="frame1" src="http://www.w3schools.com" width="500px" height="500px"></iframe>
</td>
</tr>
<tr><td>
<input type="button" value="Change IFrame sRC Location" name="btnRedirect" runat="server" onclick="RedirectPage()"/>
</td></tr>
</table>

</body>
</html>
<pre>
Hope it helps
Regards,Mahe


试试这个.. :)





try this..:)


function SetPage(url)
{
 
document.getElementById("myframe").setAttribute("src", url);
 
}







<iframe id="myframe"></iframe>
 
<span onclick="SetPage('MyPage1.aspx')">My Page1</span>
<span onclick="SetPage('MyPage2.aspx')">My Page2</span>
<span onclick="SetPage('MyPage3.aspx')">My Page3</span>
<span onclick="SetPage('MyPage4.aspx')">My Page4</span>


这篇关于如何在Iframe中重定向页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆