只要设置链接的target="frame的名字" 就好了吧不需要用js
如果是要换frame 的里面的链接内容
就用
window.frames["id"].src
或者直接 window.framename.src
如果是要换frame 的里面的链接内容
就用
window.frames["id"].src
或者直接 window.framename.src
解决方案 »
- 关于onclick事件不触发的问题----急急急急急急啊
- 图片自适应大小问题
- js脚本软件????
- 如何实现mouseover出现如这论坛左边的头像出现详细信息框
- 哪位有幻宇js系列的jsvb原代码,请给一份谢谢了,急用
- JS封装问题(prototype)
- 用javascript动态添加Radio或checkbox,怎样指name属性?
- <script>self.top.document.frames.EditBox.IMAGESelect('"&fname&"');</script>的问题
- 在线等待...
- 请问一下IE中有没有模态窗口?
- 在jsp中如何实现背景图片的大小随浏览器窗口大小而改变
- 这么好的重写系统alert和confirm的程序 竟然不兼容FF 谁来挽救一下它呢?
<tr>
<td background="images/08_03_02.jpg" align="center" valign="middle" nowrap id="frmTitle" name="frmTitle" style="width: 160px">
<iframe id="BoardTitle" name="main" style=" height: 100%; width:160; VISIBILITY: inherit; Z-INDEX: 2" scrolling="no" frameborder="0" src="lefttree.aspx"></iframe>
</td>
<td align="center" background="images/b3.gif" style="width: 12px">
<table width="7" height="64" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td valign="middle" background="images/b8.gif" onclick="switchSysBar()" style="width: 8px"><span class="navPoint" id="switchPoint" title="关闭/打开 菜单">3</span>
</td>
</tr>
</table>
</td>
<td>
<iframe id="frmright" name="frmright" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1" scrolling="no" frameborder="0" src="szaic.aspx"></iframe>
</td>
</tr>
</table>客户端运行时动态改变frmright的SRC,是要动态呀
//在topframe 下
//js
window.frame.frmright.src="url";
window.frames["frmright"].src
子frame
window.parent.frame.frmright.src=...;
或者是 window.parent.frames["frmright"].src
所以楼上对应switchSysBar()应该这样写:function switchSysBar()
{
window.frames["frmright"].location.href="action(或你需要的名字).aspx"
}
左边页面 代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>left</title>
<script type="text/jscript">
function opens(url){
parent.document.getElementById("main").src=url;
}
</script>
</head><body><ul>
<li onclick="opens('http://www.163.com')" >163.com</li>
<li onclick="opens('http://www.sina.com')" >sina.com</li>
<li onclick="opens('http://www.csdn.net')" >csdn.net</li>
</ul>
</body>
</html>主页代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
</head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="200" >
<iframe src="left.html" width="180" ></iframe>
</td>
<td><iframe src="" id="main" width="100%" height="400" ></iframe></td>
</tr>
</table>
</body>
</html>
不知道 lz 是到底要换 frame 的src 还是链接的src 如果是连接的src 就是 我引用他这样写的
<asp:ImageButton ID="ImageButton3" runat="server" Height="25px" Width="73px" ImageUrl="~/images/p1.jpg"
OnClientClick="test()" />
现在在服务端有这样一个按钮,我的意思是点击这按钮动态改变frmright的SRC,用response.write();可不可以实现,或者用脚本也行
<asp:ImageButton ID="ImageButton3" runat="server" Height="25px" Width="73px" ImageUrl="~/images/p1.jpg"
OnClientClick="test()" /> <!--服务器端控件按钮-->
<table align="center" width="845" height="950" border="0" cellpadding="0" cellspacing="0">
<tr>
<td background="images/08_03_02.jpg" align="center" valign="middle" nowrap id="frmTitle" name="frmTitle" style="width: 160px">
<iframe id="BoardTitle" name="main" style=" height: 100%; width:160; VISIBILITY: inherit; Z-INDEX: 2" scrolling="no" frameborder="0" src="lefttree.aspx"> </iframe>
</td>
<td align="center" background="images/b3.gif" style="width: 12px">
<table width="7" height="64" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td valign="middle" background="images/b8.gif" onclick="switchSysBar()" style="width: 8px"> <span class="navPoint" id="switchPoint" title="关闭/打开 菜单">3 </span>
</td>
</tr>
</table>
</td>
<td>
<iframe id="frmright" name="frmright" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1" scrolling="no" frameborder="0" src="szaic.aspx"> </iframe>
</td>
</tr>
</table>
上面有一按钮服务器端的,点击时在frmright里面打开新的页面
window.frames['framename'].location.href = "http://www.baidu.com";
这样是不行的
我现在需要改变iframe的src,上面的方法都没有用,不知哪位大侠可以指点一下了?
<div id="Left_select" align="center" style="width:230">
 <input type="button" id="bt1" class="button2" value="BT1" title="" onclick="bt_click('bt1');"/>
 <input type="button" id="ButtonOnline" class="button2" value="BT2" title="" onclick="bt_click('bt2');"/>
 <input type="button" id="ButtonOffline" class="button2" value="BT3" title="" onclick="bt_click('bt3');"/>
</div>
在Iframex.js中添加代码:
function bt_click(id)
{
switch(id)
{
case "bt1":
document.getElementById("Iframe1").scr='bt1.aspx';
break;
case "bt2":
document.getElementById("Iframe1").scr='bt2.aspx';
break;
case "bt3":
document.getElementById("Iframe1").scr='bt3.aspx';
break;
}
}点击按钮,Iframe1没有任何反应。哪位朋友能给点提示,谢谢!!