方法一
如何改变iframe的src地址
<body>
<input type="button" value="改变地址" onClick="parent.displayinhere.location.href='http://www.baidu.com/'">
<iframe name="displayinhere" width=250px; height=200px; src="http://www.hao123.com">
</body>
仁则见人,智则风智
1、
<input οnclick="document.all.mxh.location.replace('http://sina.com.cn')" type=button value=change><br>
<iframe id=mxh src="http://colorweb.go.163.com"></iframe>
2、
<input οnclick="document.all.rpl.innerHTML='<iframe id=mxh src=\'http://www.sina.com\'></iframe>'" type=button value=change><br>
<span id=rpl><iframe id=mxh src="http://colorweb.go.163.com"></iframe></span>
方法二
<A href="javascript:NavGoto();" onClick="functiona();return false;">通讯录</A>
<>
<iframe name="main" src="test.html"></iframe>
</>
<script>
functiona()
{
window.frames["main"].location.href=http://www.baidu.com
}
</script>
方法三
<A id="gNav_A" href="javascript:NavGoto();" onClick="NavGoto(this);return false;">主页</A>
<iframe id="infrm" src="iframe-A.html" name="infrm" width="100%" frameborder="0" οnlοad="this.height=150"></iframe>
<script type="text/javascript">
//导航
function NavGoto(O){
}
</script>
方法四:
这是在asp里子页面调用主页面嵌套的iframe时用到的代码:
包括传递的参数
response.Write("document.write('<a href=""#""οnclick=javascript:window.frames[""newslist""].location.href=""newslist.asp?nclass="&rs(0)&""";><li>"&rs(1)&"</li></a>');")