$(function(){ //遍历获取的input元素对象数组,绑定click事件 var len = $("input[type='file']").length; ; i < len; i++){ $("input[type='file']").eq(i).click(function(){ $(this).next().val(""); $(this).next().hide(); $(this).css("width&q…
用了javascript和jquery很久,把所有元素节点的操作总结了下,放在博客上作为记录. Javascript获取元素的主要方式有三种 1.document.getElementById('main'):表示从document中查找一个id是main的dom节点.(这个跟$('#main')的作用是一样的) 2.通过名称name选取元素document.getElementsByName("domName") a. 返回值是一个nodeList集合(区别于Array) b. 和I…
1.jquery获取url很简单,代码如下 window.location.href; 2.javascript获取url参数 function getUrlParam(name) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).match(reg); /…