求一段Javascript代码

uranas 2010-02-16 01:13:28
<iframe name="new"></iframe>
<a href="login.htm" id="other" target="new">login</a>
...
<a href="link.htm" id="mine" target="new">open</a>

针对上述的程序:
 当点击open时,不但要打开link.htm,
 还要把id是other的显示与连接对象给改了,如:
  login ⇒ logout
  login.htm ⇒ logout.htm
...全文
49 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dandande 2010-02-16
  • 打赏
  • 举报
回复
引用 1 楼 jnwentao 的回复:
HTML code<iframename="new" id="new" style="border:1px solid red;width:500px;height:200px;"></iframe><ahref="login.htm" id="other" target="new">login</a>
...<ahref="link.htm" onclick="op()" id="mine" target="new">open</a><scripttype="text/javascript">function op(){
document.getElementById('other').href='logout.htm';
document.getElementById('other').innerHTML='logout';
}</script>

同意,好用
jnwentao 2010-02-16
  • 打赏
  • 举报
回复


<iframe name="new" id="new" style="border:1px solid red;width:500px;height:200px;"> </iframe>
<a href="login.htm" id="other" target="new">login </a>
...
<a href="link.htm" onclick="op()" id="mine" target="new">open </a>


<script type="text/javascript">
function op(){
document.getElementById('other').href='logout.htm';
document.getElementById('other').innerHTML ='logout';
}
</script>

87,914

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧