当前位置:首页 > JavaScript

Caller和Callee的区别

canca16年前 (2010-10-17)JavaScript563
<html>
 <head>
  <title>Caller和Callee的区别</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
 </head>
 <body>
  <script type="text/javascript">
   function calleeTest(){
    arguments.callee.say("Mr.CT","您好!"); //获取当前函数句柄
   }
   calleeTest.say = function(userName,value){
    alert(userName + "说:" + value);
   };
   function callerTest(){
    (function(){
     arguments.callee.caller.goodbye("Mr.CT","Canca Torvals"); //获取调用当前函数的函数
    })();
   }
   callerTest.goodbye = function(userName,userName2){
    alert(userName + " 向 " + userName2 + " 说再见.");
   };
   calleeTest();
   callerTest();
  </script>
 </body>
</html>

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/273.html

标签: JavaScript
分享给朋友:

“Caller和Callee的区别” 的相关文章

javascript MailTo 邮件技巧

调用email的方法 //<a href="mailto:talantlee@126.com">Email</a>window.location.href="mailto:talantlee@126.com";myform.action="mailto:talant…

javascript 中面向对象編程 (类的继承)

// 人的基類var Person=new ( function(){  var sex;  var name;  this.getSex=function() &nbs…

javascript 弹出式窗体详解

1>window.prompt(text, value) 簡單的基與模態窗體的對話框,(返回你輸入)   var v=window.prompt("提示","請輸入你的名字")2>window.confirm(text,mess)  模態確認框(返回"是/否…

javascript在IE和Firefox中的兼容考虑

1.document.formName.item("itemName") 问题说明:IE下,可以使用document.formName.item("itemName")或document.formName.elements["elementName"];Firefox下,只能使用docum…

event事件兼容mozilla firefox的问题

本来一个写好了的脚本在IE下正常,可是在mozilla firefox中我们发现程序报类似如下的错误: event is not defined obj has no properties 原因是Firefox中使用了不同的事件对象模型,不同于IE Dom,用的是W3C Dom. 下是我在网上找到的…

JavaScript对粘贴板的全操作

<html>    <head>        <script language="javascript">function copy_clip(copyObjectName…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。