return

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 3     <head>
 4         <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 5         <title>return</title>        
 6         <script type="text/javascript">
 7             window.onload=num;    
 8             console.log(num(1));   //1
 9             console.log(num(2));   //2
10             console.log(num(3));   //null
11 
12             function num(node){
13                 if(node==1){ return 1;};
14                 if(node==2){ return 2;};
15                 return null;
16             }
17         </script>
18     </head>
19     <body>        
20     </body>
21     </html>    
 1 <script type="text/javascript">
 2     window.onload=num;
 3     running=true;    
 4     console.log(num(1));   //false;
 5     console.log(num(2));   //true alert(22);
 6     console.log(num(3));   //true alert(22);
 7 
 8     function num(node){
 9         if(node==1){ return false;};
10         alert(22);
11         return true;
12     }
13 </script>

 

posted @ 2013-11-25 14:18  Western Journey  阅读(171)  评论(0编辑  收藏  举报