我也想知道,找了半天只找到一篇 iframe 的。
我打算实在不行就用 iframe 凑合了。
楼主也看看 You can also pass data to and from an <iframe>
Firstly, set up your iframes with a name:
Code: <iframe src="about:blank" name="iframe1"></iframe>
<iframe src="about:blank" name="iframe2"></iframe>
In the main page you simply use the iframe name to call the function, variable or object you want. From an iframe, you can call functions variables and objects in the main page OR another iframe. This is how you could do all of these things in one example... save this as 'iframeexample.html' Code:
<html> <head>
<title>iframe example 1.0</title>
<script LANGUAGE="JavaScript" type="text/javascript">
var wot; function anothertest(){
alert("This alert is from the parent.");
} </script>
</head> <body>
<p>Save this bit as 'iframeexample.html'</p> <p><a href="#" onClick="iframe1.location.href='http://www.odford.co.uk';">Change the location of IFRAME 1</a></p>
<p><a href="#" onClick="iframe2.test();">Launch a function in IFRAME 2</a></p> <p>
<iframe src="about:blank" name="iframe1" width="600" height="400"></iframe>
</p> <p>
<iframe src="pagetwo.html" name="iframe2" width="400" height="200"></iframe>
</p> </body> </html> save this as 'pagetwo.html' Code:
<html> <head>
<title>iframe example 1.0 - Page Two</title>
</head> <body>
<p>Save this bit as 'pagetwo.html' in the same folder</p> <p id="one"><a href="#" onClick="parent.iframe1.location.href='http://www.northernline.net';">Change the location of IFRAME 1 from IFRAME 2 via the 'parent' window.</a></p>
<p id="two"><a href="#" onClick="parent.anothertest();">Launch a function in 'Parent'</a></p>
<script LANGUAGE="JavaScript" type="text/javascript">
function test() {
alert('THIS ALERT HAS COME FROM IFRAME 2 - PAGE TWO');
}
</script>
</body> </html>
我打算实在不行就用 iframe 凑合了。
楼主也看看 You can also pass data to and from an <iframe>
Firstly, set up your iframes with a name:
Code: <iframe src="about:blank" name="iframe1"></iframe>
<iframe src="about:blank" name="iframe2"></iframe>
In the main page you simply use the iframe name to call the function, variable or object you want. From an iframe, you can call functions variables and objects in the main page OR another iframe. This is how you could do all of these things in one example... save this as 'iframeexample.html' Code:
<html> <head>
<title>iframe example 1.0</title>
<script LANGUAGE="JavaScript" type="text/javascript">
var wot; function anothertest(){
alert("This alert is from the parent.");
} </script>
</head> <body>
<p>Save this bit as 'iframeexample.html'</p> <p><a href="#" onClick="iframe1.location.href='http://www.odford.co.uk';">Change the location of IFRAME 1</a></p>
<p><a href="#" onClick="iframe2.test();">Launch a function in IFRAME 2</a></p> <p>
<iframe src="about:blank" name="iframe1" width="600" height="400"></iframe>
</p> <p>
<iframe src="pagetwo.html" name="iframe2" width="400" height="200"></iframe>
</p> </body> </html> save this as 'pagetwo.html' Code:
<html> <head>
<title>iframe example 1.0 - Page Two</title>
</head> <body>
<p>Save this bit as 'pagetwo.html' in the same folder</p> <p id="one"><a href="#" onClick="parent.iframe1.location.href='http://www.northernline.net';">Change the location of IFRAME 1 from IFRAME 2 via the 'parent' window.</a></p>
<p id="two"><a href="#" onClick="parent.anothertest();">Launch a function in 'Parent'</a></p>
<script LANGUAGE="JavaScript" type="text/javascript">
function test() {
alert('THIS ALERT HAS COME FROM IFRAME 2 - PAGE TWO');
}
</script>
</body> </html>
解决方案 »
- 我现在有个项目要发布 用的MYECLIPSE 都是用这个软件自带的包 请问怎么发布到TOMCAT???从来没弄过!!!!
- JSF,国际化
- struts 2 interceptor 问题请教
- JSF或者说JSP中怎么得到我的应用的根目录,比如我的程序在spmai目录下的,怎么在JSP中得到这个目录的
- 当一个FORM的enctype="multipart/form-data"时,getParameter()为什么会失效?
- 求教一个简单的问题:
- 本人现在急需wap程序 谁有者本人愿意交换或购买! 来者有分!
- 请教关于用JSP编写网络硬盘
- 怎么能够拥有自己的JSP论坛呢
- servlet路径问题
- 新手的问题--如何将16进制字符串转换成字节码
- 如何实现文件浏览
...
<%String index=request.getParameter("index");%>
<html>
<head>
<frameset rows="60, *" frameborder=0 framespacing=0>
<frame name="frmToolBar" src="toolBar.jsp?index=<%=index%>">
<frame name="frmList">
</frameset>
</head>
...
</html>
... ...
String itemCount=request.getParameter("index");
if("null".equals(itemCount)){
itemCount="0";
}
int index=0;
%>
...