zoukankan      html  css  js  c++  java
  • Js的执行

     1 <html>
     2 <head>
     3     <title>测试启动</title>
     4 </head>
     5 <body>
     6     <input type="button" onclick="result.init3()" value="Test" />
     7     <input type="button" id="test1" value="Test1" />
     8     <script type="text/javascript">
     9         var result = function () {
    10             var init1 = function () {
    11                 alert(1);
    12             };
    13             var init2 = function (obj) {
    14                 alert(obj);
    15             };
    16             var init5 = function () {
    17                 document.getElementById("test1").onclick=function(){
    18                     alert(5);
    19                 }
    20             }
    21             return {
    22                 init: function () {
    23                     init1();
    24                     init2(2);
    25                     init5();
    26                 },
    27                 init3: function () {
    28                     alert(3);
    29                 },
    30                 init4: function () {
    31                     alert(4);
    32                 }
    33             }
    34         }();
    35         window.onload = function () {
    36             result.init();
    37         }
    38     </script>
    39 </body>
    40 </html>

    页面加载弹出1,2

    点击test1按钮,弹出5

  • 相关阅读:
    装配Bean
    百练
    东软小选拔
    俄罗斯乘法
    POJ
    ACdream
    javascript 链式作用域
    ie6/7 bug
    onreadystatechange 和 status
    瀑布流 <<转>>
  • 原文地址:https://www.cnblogs.com/Cein/p/7073910.html
Copyright © 2011-2022 走看看