作家
登录

javascript父子通信

作者: 来源:www.28hudong.com 2013-03-30 03:27:49 阅读 我要评论

<script language="javascript" defer="defer"> var parent = { // say:function () { // alert("parent_say"); }, alert:function () { // alert("parent"); this.say(); } }; // parent.addChild("child", { // say:function () { // alert("child_say"); }, alert:function () { // alert("child"); this.parent.say(); } } ); //parent.child.alert(); //parent.alert(); var c = parent.child; c.alert(); </script> <script language="javascript"> Object.prototype.addChild=function(oName, obj) { eval("var p=this."+oName+"= new Object()"); this[oName]=obj; this[oName].parent=this; } </script>效果演示: [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

  推荐阅读

  asp 的 分词实现代码

<% a="日本是中国的一个省|我们美丽中国的张家界!" b="中国,我们,张家界,日本,美国,苹果" b=split(b,",") a=split(a,"|") for k=0 to ubound(a) s="" n="" for i=0 to ubound(b) if instr(a(k),b(i))>0 then >>>详细阅读


本文标题:javascript父子通信

地址:http://www.17bianji.com/kaifa2/JS/30429.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)