在线等待求教——用js操纵iframe的页面跳转?

redox2009 2011-05-21 12:33:06
比如我现在有一个index页面做框架,有左右两个iframe,代码如下。
需要实现的是,当在左框中点击submit时 检查用户名是否为空,如果为空则alert,不为空则是左右两个iframe都跳转。
现在的问题是,怎样让两个frame同时跳转?
在线等各位大牛解答~~~!
index.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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.left{float:left; width:400px; height:400px}
.right{float:left; width:400px; height:400px}
</style>
</head>

<body>
<div class="left">
<iframe src="maillogin.jsp" width="100%" height="100%" frameborder="0" scrolling="no";></iframe>
</div>
<!----在上一个iframe中写js代码让两个iframe同时跳转---->
<div class="right">
<iframe src="mailcheck.jsp" width="100%" height="100%" frameborder="0" scrolling="no";></iframe>
</div>
</body>
</html>
...全文
428 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
罢懂 2011-05-21
  • 打赏
  • 举报
回复
或者

window.parent.frames[1].location.reload();
window.location.reload();
罢懂 2011-05-21
  • 打赏
  • 举报
回复
其中一个框架内页面需要刷新的地方加入下面JS

window.parent.frames[0].location.reload();
window.parent.frames[1].location.reload();
redox2009 2011-05-21
  • 打赏
  • 举报
回复
在右边iframe中的代码是一个form,其中会提交一个username,提交用submit或button均可。
我的想法是写onclick="submitForm()"
然后定义function submitForm(){ ... ... }的具体操作。
这里怎么都写不出来。。。。求各路大牛赐教!

87,990

社区成员

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

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