社区
JavaScript
帖子详情
怎调用另外一个页面里的JavaScript函数啊
zhghl
2004-09-24 09:11:47
多谢
...全文
88
6
打赏
收藏
怎调用另外一个页面里的JavaScript函数啊
多谢
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
歪歪
2004-09-24
打赏
举报
回复
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=15>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>操作系统</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/Windows/">Windows系列</A></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=73>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>实用软件</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff height=54>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/filemange/">管理维护
</A><BR><BR><A
href="http://61.171.118.168/netbook/tech/imagemedia/">多媒体与图像</A>
</DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=15>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>冲浪宝典</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/creatweb/">网络组建</A><BR><BR><A
href="http://61.171.118.168/netbook/tech/goweaver/">入门技巧</A></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR></TD>
<TD vAlign=top height=581><BR>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD class=shadow vAlign=center align=middle>子父窗口之间的操作之小例子</TD></TR>
<TR>
<TD class=shadow vAlign=center align=right>
<HR color=#7d561c noShade SIZE=1>
</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="96%" align=center>
<TBODY>
<TR>
<TD class=f14b vAlign=top><!-- #BeginEditable "cont" --><BR>
<P>
用window.openr打开的子父窗口之间的操作跟框架的是不一样的,子窗口和父窗口之间有opener来联系。而源窗口要访问子窗口要通过其句柄来操作。以下小例子希望能帮助新手更了解他们的操作。</P>
<P><STRONG>test.htm</STRONG> </P>
<P><html><BR><head><BR><meta
http-equiv="Content-Type" content="text/html;
charset=gb2312"><BR><meta name="GENERATOR" content="Microsoft
FrontPage 4.0"><BR><meta name="ProgId"
content="FrontPage.Editor.Document"><BR><title>子父窗口的操作</title><BR></head><BR><body><BR><script><BR>var
win=null;<BR>function
op(){<BR>win=window.open("about:blank","win","width=200,height=200");<BR>win.document.write("<input
type='button' value='关闭父窗口'
onclick='window.opener.opener=null;window.opener.close()'>");<BR>win.document.write("<input
type='button' value='刷新你窗口'
onclick='window.opener.location.reload()'>");<BR>}<BR></script><BR><input
onclick="op()" value="打开窗口" type="button"><input type="button"
value="最小化"
onclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else
alert('还没有打开窗口或已经关闭')"><input type="button" value="最大化"
onclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else
alert('还没有打开窗口或已经关闭');"><input type=button value="关闭子窗口"
onclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else
alert('还没有打开窗口或已关闭')"><input type=button value="刷新子窗口"
onclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else
alert('窗口还没有打开或已关闭')"><input type="button" value="看子窗口的大小"
onclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('还没有打开窗口或者已关闭')};"><BR></body><BR></html></P>
<P><STRONG>运行效果如下:</STRONG></P>
<P> </P>
<META content="Microsoft FrontPage 4.0" name=GENERATOR>
<META content=FrontPage.Editor.Document name=ProgId>
<SCRIPT>
var win=null;
function op(){
win=window.open("about:blank","win","width=200,height=200");
win.document.write("<input type='button' value='关闭父窗口' onclick='window.opener.opener=null;window.opener.close()'>");
win.document.write("<input type='button' value='刷新你窗口' onclick='window.opener.location.reload()'>");
}
</SCRIPT>
<INPUT onclick=op() type=button value=打开窗口><INPUT onclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else alert('还没有打开窗口或已经关闭')" type=button value=最小化><INPUT onclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else alert('还没有打开窗口或已经关闭');" type=button value=最大化><INPUT onclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else alert('还没有打开窗口或已关闭')" type=button value=关闭子窗口><INPUT onclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else alert('窗口还没有打开或已关闭')" type=button value=刷新子窗口><INPUT onclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('还没有打开窗口或者已关闭')};" type=button value=看子窗口的大小>
<P>以上只供参考,有错请纠正,谢谢!</P><BR><!-- #EndEditable --></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<CENTER>
<SCRIPT language=JavaScript
src="网络社团--技术文档--子父窗口之间的操作之小例子.files/bottom.js"></SCRIPT>
<TABLE cellSpacing=0 cellPadding=0 width=500 align=center border=0>
<TBODY>
<TR>
<TD class=myknotse1 align=middle><BR>本网站所有资料版权归结网络社团所有<BR>© 2002~2003<FONT
color=white size=1></FONT></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
歪歪
2004-09-24
打赏
举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0077)http://61.171.118.168/netbook/tech/javascript/html/javascript.ohchina.167.htm -->
<HTML><HEAD><TITLE>网络社团--技术文档--子父窗口之间的操作之小例子</TITLE><!-- #BeginEditable "doctitle" --><!-- #EndEditable -->
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>.a {
COLOR: #000000
}
A:active {
COLOR: #000000; TEXT-DECORATION: none
}
A:link {
COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
COLOR: #ff0000; TEXT-DECORATION: underline
}
TABLE {
FONT-SIZE: 9pt
}
.white {
COLOR: #ffffff; TEXT-DECORATION: none
}
.white:active {
COLOR: #ffffff; TEXT-DECORATION: none
}
.white:hover {
COLOR: #ff0000; TEXT-DECORATION: none
}
.white:link {
COLOR: #ffffff
}
.black {
COLOR: #000000; TEXT-DECORATION: none
}
.black:active {
COLOR: #000000; TEXT-DECORATION: none
}
.black:hover {
COLOR: #ff0000; TEXT-DECORATION: none
}
.black:link {
COLOR: #000000; TEXT-DECORATION: none
}
</STYLE>
<LINK href="网络社团--技术文档--子父窗口之间的操作之小例子.files/style.css" type=text/css
rel=stylesheet>
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY bottomMargin=0 bgColor=#ffffff leftMargin=0 topMargin=0 rightMargin=0
marginwidth="0" marginheight="0">
<DIV align=center>
<SCRIPT language=JavaScript
src="网络社团--技术文档--子父窗口之间的操作之小例子.files/top.js"></SCRIPT>
<SCRIPT language=JavaScript
src="网络社团--技术文档--子父窗口之间的操作之小例子.files/items.js"></SCRIPT>
</DIV>
<TABLE cellSpacing=0 cellPadding=0 width=778 align=center>
<TBODY>
<TR>
<TD vAlign=top width=160 height=581>
<TABLE cellSpacing=0 cellPadding=0 width="100%">
<TBODY>
<TR>
<TD height=52>
<DIV align=center><IMG height=48
src="网络社团--技术文档--子父窗口之间的操作之小例子.files/webdi.jpg"
width=160></DIV></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=15>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>网络时代</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/creatsite/">网站建设</A>
</DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=84>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>网页设计</DIV></TD></TR>
<TR>
<TD vAlign=top width="100%" bgColor=#ffffff height=55>
<DIV align=center>
<P><A
href="http://61.171.118.168/netbook/tech/html/">HTML</A><BR><A
href="http://61.171.118.168/netbook/tech/css/">CSS</A><BR><A
href="http://61.171.118.168/netbook/tech/javascript/">JavaScript</A><BR><A
href="http://61.171.118.168/netbook/tech/dreamweaver/">DreamWeaver</A><BR><A
href="http://61.171.118.168/netbook/tech/flash/">Flash</A></P></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=15>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>美工教室</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/fireworks/">Firworks</A><BR><A
href="http://61.171.118.168/netbook/tech/photoshop/">Photoshop</A><BR><A
href="http://61.171.118.168/netbook/tech/3dmax/">3DS
Max</A><BR><A
href="http://61.171.118.168/netbook/tech/CorelDRAW/">CorelDraw</A></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
<TABLE cellSpacing=0 cellPadding=1 width="100%" bgColor=#cccc99
border=0><TBODY>
<TR>
<TD width="100%" height=15>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#cccc99
border=0>
<TBODY>
<TR>
<TD vAlign=center align=left bgColor=#eeeecc height=2>
<DIV align=center>程序开发</DIV></TD></TR>
<TR>
<TD vAlign=top bgColor=#ffffff>
<DIV align=center><A
href="http://61.171.118.168/netbook/tech/Visualbasic/">Visual
Basic</A><BR><A
href="http://61.171.118.168/netbook/tech/VisualC++/">Visual
C++</A><BR><A
href="http://61.171.118.168/netbook/tech/java/">Java</A><BR><A
href="http://61.171.118.168/netbook/tech/Delphi/">Delphi</A><BR><A
href="http://61.171.118.168/netbook/tech/perl/">Perl</A><BR><A
href="http://61.171.118.168/netbook/tech/php/">PHP</A><BR><A
href="http://61.171.118.168/netbook/tech/asp/">ASP</A><BR><A
href="http://61.171.118.168/netbook/tech/dotnet/">.NET</A><BR><A
href="http://61.171.118.168/netbook/tech/other_language/">其他开发语言</A><BR><A
href="http://61.171.118.168/netbook/tech/database/">数据库开发</A><BR><A
href="http://61.171.118.168/netbook/tech/game/">游戏开发</A><BR><A
href="http://61.171.118.168/netbook/tech/fileformat/">文件格式</A><BR><A
href="http://61.171.118.168/netbook/tech/other/">其
他</A><BR></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
cybernaute
2004-09-24
打赏
举报
回复
最好把一些公用的函数等,放在一个独立的文件里,然后调用!
zltostem
2004-09-24
打赏
举报
回复
----- a.asp -----
<input type=button value=ok onclick="document.frames[0].show();">
<iframe src='b.asp'></iframe>
----- b.asp -----
Is b.asp
<script language="javascript">
<!--
function show()
{
alert('clement');
}
//-->
</script>
whnnet
2004-09-24
打赏
举报
回复
知道窗口对象为winX,可以用
winX.methodXX()
winX.变量d
whnnet
2004-09-24
打赏
举报
回复
2个窗口必须有关系才行,比如:
var xxx = "ok"
a = window.open("b.htm")
在b.htm可以用
alert(opener.xxx)
JS
函数
之间的
调用
(
函数
内
调用
一个
函数
、
调用
函数
内部的
函数
)
文章目录JS
函数
内
调用
一个
函数
JS在外部
调用
函数
内部的
函数
JS
函数
内
调用
一个
函数
代码示例 要点:在
一个
函数
内
调用
另外
一个
函数
!!!!(常用)(分开写两个function
函数
, 然后再
一个
函数
内进行
调用
!) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <scr
html中
调用
javascript
函数
,如何在HTML中
调用
JavaScript
函数
如何在HTML中
调用
JavaScript
函数
?在HTML文档中有很多方法可以
调用
JavaScript
函数
,这也不是一件容易的事。首先,我们使用了最简单的方法之一来
调用
HTML文档中的
JavaScript
函数
:在这种方法中,我们将在HTML文档的头部创建并定义
一个
函数
。要在html文档中
调用
此
函数
,我们必须创建
一个
简单的按钮,并使用onclick事件属性(它是事件处理程序)以及它,我们可以通过单击按...
JavaScript
函数
调用
无论您是在全局范围内
调用
函数
,还是作为对象的方法
调用
函数
,或者是通过构造
函数
创建对象的实例并
调用
其方法,这些示例都提供了
函数
调用
的不同方法。1. 声明
函数
并
调用
:首先使用`function`关键字声明
一个
函数
,然后通过
函数
名加上括号来
调用
函数
。3. 箭头
函数
:箭头
函数
是一种简化的
函数
表达式语法。4. 方法
调用
:
函数
可以作为对象的方法
调用
,使用对象名加上方法名和括号来
调用
函数
。2.
函数
表达式:可以将
函数
赋值给变量,然后通过变量名加上括号来
调用
函数
。//
调用
对象的方法。//
调用
对象的方法。
JavaScript
函数
调用
方式:简单
调用
+在超链接中
调用
JavaScript
函数
+在事件中
调用
JavaScript
函数
代码如下 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>在超链接中
调用
JavaScript
函数
</title> <script language="
javascript
"> function text(){ alert("欢迎点击我!"); } </script> </head
javascript
一个
函数
调用
另外
一个
函数
的值
源码: 方法一: script> $(function(){ b(); }); function a(){ var a =1; return a; //一定要return出去,如果不return出去,因为参数是私有的,另外
一个
函数
无法获取到 } function b(){ var b =
JavaScript
87,997
社区成员
224,708
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章