tcrct 2008-10-12 07:55:18
有以下一句代码:
<a herf="javascript:void(0)" onclick="javascript:test('../admin/jsp/test.jsp')" >test</a>

function test(url){
window.parent.openpage(url);
}


在父窗口里:
function openpage(entUrl){
alert(entUrl);
window.frames.sampleframe.location.href = entUrl
}

在这里的父窗口是的alert能打印出传过来的值,但不知道为什么iframe里的href没动作,看了一下,IE窗口里的进度条也刷了一下的,但为什么没动作呢?后来我将<a></a>锚标记改为:
<a herf="javascript:test('../admin/jsp/test.jsp')" >test</a>
又可以了,但不知道这是什么原因呢?请各位高手说说看.
...全文
519 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yusan4783 2009-09-14
  • 打赏
  • 举报
回复
我该成了这样的 window.parent.frames.sampleframe.location.href
yangshenghong 2008-11-14
  • 打赏
  • 举报
回复
herf="javascript:void(0)" onclick="javascript:test('../admin/jsp/test.jsp')"
url是链接,不是onclick事件吧
mengxiaoyaosss 2008-11-14
  • 打赏
  • 举报
回复
http:http://www.uplooking.com/detail.php?id=701//www.uufax.com/hhttp://www.itcast.net/subject/lesson/dotnet/index.htmlttp://www.itcast.net/subject/lesson/dotnet/index.hthttp://www.ibm.com/developerworks/cn/xml/x-extensxml/?S_TACT=105AGX52&S_CMP=tec-csdnml
tcrct 2008-10-14
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 dgtgiqfhv 的回复:]
javascript必须用标准格式,也就是window.frames.sampleframe.src = entUrl;意思是目标地址与源地址的区别
[/Quote]

就算是写成window.frames.sampleframe.src = entUrl也是不能触发事件的。
dgtgiqfhv 2008-10-14
  • 打赏
  • 举报
回复
javascript必须用标准格式,也就是window.frames.sampleframe.src = entUrl;意思是目标地址与源地址的区别
tcrct 2008-10-14
  • 打赏
  • 举报
回复
没有满意的答案呀。高手们回答下吧
junp2007 2008-10-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 Free_Wind22 的回复:]
谁来解释下void(0);
[/Quote]暂时理解为return false;
Cyril_Tam 2008-10-13
  • 打赏
  • 举报
回复
herf="javascript:void(null)"
Jarvis-Li 2008-10-13
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 junp2007 的回复:]
引用 2 楼 Free_Wind22 的回复:
谁来解释下void(0);
暂时理解为return false;
[/Quote]
BearRui 2008-10-12
  • 打赏
  • 举报
回复
应该是:
window.frames.sampleframe.src = entUrl;
2008-10-12
  • 打赏
  • 举报
回复
谁来解释下void(0);

87,917

社区成员

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

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