手边星辰

博客园 首页 新随笔 联系 订阅 管理

1.Firefox之firebug调试js,可用id搜索,打断点调试。

2.js中的||和&&

  a.逻辑运算符

逻辑或运算符 (||)
result = expression1 || expression2;
两表达式有或两等于 True则 result True

见http://itworktor.blog.163.com/blog/static/175203029201078105625547/

  b.JScript 使用下面规则来把非 Boolean 值转换 Boolean 值: 

1.所有对象都被认 true
2.字符串当且仅当空时才被认 false
3.null 和 undefined 被认 false
4.数字当且仅当 0 时才 false

 

在火狐的firebug中:shift+f5,找到代码片段速记器,可以编写javaScript并运行。

 

没秒钟调用多次js函数:

<html>
<body>
<form>
    <input type="text" id="gcount" size="35" />    
    <script language=javascript>
       var i=0;
       var int=self.setInterval("gcount()", 10);    //没秒钟执行1000/10=200次   
       function gcount(){
            i=i+1;
           document.getElementById("gcount").value = i                 
        }
    </script>
</form>
<button onclick="int=window.clearInterval(int)">Stop interval</button>
</body>
</html>

 

 

 

posted on 2014-06-16 16:12  手边星辰  阅读(113)  评论(0编辑  收藏  举报