js一些工作中经常用到的脚本

来源:互联网 发布:胜百家自动关注软件 编辑:程序博客网 时间:2024/04/29 04:06

1.js 浏览器返回前一页 history

2.js函数传参

td.innerHTML = "<a href='#'  onclick='delFileRow("+(i+1)+")'>删除</a>";
 
配合struts2的标签
 <td><a href='#'  onclick='delFileRow(<s:property value="#assignFile.rowNum"/>)'>删除</a></td>

3. jquery  在做class 选择器时要注意如下的情况。
<h3 class="state-txt ftx-02">测试用例</h3>之前我是这样用户的  $('.state-txt ftx-02').  这样用,我一直无法选择出h3这个dom.如果一个dom有两个class.在用jquery做class选择器时,只需要用一个class就ok了。如:  $('state-txt')

4. jquery 中如果判断某一个元素是否存在

http://learn.jquery.com/using-jquery-core/faq/how-do-i-test-whether-an-element-exists/

可以使用length 方法。


原创粉丝点击