window.c 这句有什么特别意义吗

解决方案 »

  1.   

    window.c = ... // 赋值语句;
    function(){...}() // 赋值语句的右侧表达式,这叫 匿名函数自调用,最后滴括号很重要!
    由于 function(){...}() 没有返回值,
    因此 alert(window.c) 仍为 undefined!
      

  2.   

    真滴没意义!
    去掉以后效果一样!
    javascript:alert(function(){document.getElementsByTagName("input")[0].value = "你看看我的长度有没有4个字符呢?"}()) 但是如果匿名函数有返回值滴话,那就有意义了,即为 window.c 赋值!
      

  3.   

    改了改,有返回值了
    L@_@K
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title> new document </title>
      <meta name="generator" content="editplus" />
      <meta name="author" content="" />
      <meta name="keywords" content="" />
      <meta name="description" content="" />
      <script type="text/javascript">
      <!--
    var i = 0;
      //-->
      </script>
     </head> <body>
    <input type="text" id="" size="100" />
    <input type="text" id="" size="100" />
    <input type="text" id="" size="100" />
    <input type="text" id="" size="100" />
      <input type="button" value="run" onclick="alert(window.c=function(){return document.getElementsByTagName('input')[i++].value = '你看看我的长度有没有'+i+'个字符呢?';}())" />
      <input type="button" value="show window.c" onclick="alert(window.c)" />
     </body>
    </html>