js如何对iframe进行操作?

owowo 2004-09-27 03:16:17
一个页面,内含一个iframe,主页面中有一个下拉菜单,我现在要通过该下拉菜单控制iframe里的页面变换该如何写js调用?

另外我主页面中点击button后,执行js方法,先提交iframe中页面的button该如何写?


主页面
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="Form1" id="Form1" action="Opt.jsp?UserID=<%=UserID%>" method="post">
<p>
<select name="select">
<option value="1.htm" selected>a</option>
<option value="2.htm">b</option>
</select>
</p>
<tr>
<th></th>
<td>
<iframe class="Composition" ID="Composition" style="width:400px;height:200px" src="test.jsp"></iframe>
</td>
</tr>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>

1.htm
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>
...全文
217 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
owowo 2004-09-27
  • 打赏
  • 举报
回复
不对呀

主页面
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="Form1" id="Form1" onsubmit="Composition.document.form1.submit();" method="post">
<p>
<select name="select" onchange="Composition.src=this.value">
<option value="2.htm" selected>a</option>
<option value="1.htm">b</option>
</select>
</p>
<tr>
<th></th>
<td>
<iframe class="Composition" ID="Composition" style="width:400px;height:200px" src="1.htm"></iframe>
</td>
</tr>
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>

iframe页
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="2.htm">
<input type="submit" name="Submit" value="提交">
</form>
</body>
</html>
soonquick 2004-09-27
  • 打赏
  • 举报
回复
1.<select name="select" onchange="Composition.src=this.value">
2.<input type="submit" name="Submit" value="提交" onclick="document.frames['Composition'].document.all.Submit.click();">
ice_berg16 2004-09-27
  • 打赏
  • 举报
回复
1.<select name="select" onchange="Composition.src=this.value">
2.<form onsubmit="Composition.document.form1.submit();">

87,915

社区成员

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

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