JavaScript常见错误总结:
1.getElementById前面需要加document
2.函数参数直接写,如:function fn1(name){……}
3.<input type="textbox" id="txtName" name="txtName" onBlur="fun2(this.value);" />
4.<a href="#" onmouseover="window.status='Hello javascript!'; return true;">move me</a>
   必须加上 return true;
5.  <script language="javascript" type="text/javascript">
        var today = new Date();
        document.writeln("现在的时间是:" + today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds());
        document.write("今天的日期为:" + today.getYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate());
    </script>
    月份范围为:0~11 
    年度today.getYear()在FF中存在问题,可以使用 getFullYear()方法,各浏览器均适用。
    也可以自定义初始化日期,如:var myDate = new Date(1987,0,6); new Date(96,0,13,10,50,0);
6.数学运算可以使用:document.write("<br />number:" + Math.abs(Math.sin(today.getSeconds())));
7.框架
    <FRAMESET COLS="50%,50%">
      <FRAMESET ROWS="50%,50%">
        <FRAME SRC="cell.html">
        <FRAME SRC="cell.html">
      </FRAMESET>
      <FRAMESET ROWS="33%,33%,33%">
        <FRAME SRC="cell.html">
        <FRAME SRC="cell.html">
        <FRAME SRC="cell.html">
      </FRAMESET>
    </FRAMESET>
    在框架页中,执行其他框架页中的函数,可以使用:parent.frame1.function1(); 的形式。
Posted on 2007-03-29 08:03  李通通  阅读(316)  评论(0编辑  收藏  举报