function getquerystring(name)
url的引數&引數名1=***x&引數名2=***x&引數名3=***x
alert(getquerystring("引數名1"));
alert(getquerystring("引數名2"));
alert(getquerystring("引數名3"));
jquery **:
把下面**。放到js檔案中
/*** jquery.query - query string modification and creation for jquery
* written by blair mitchelmore (blair dot mitchelmore at gmail dot com)
* licensed under the wtfpl (
* date: 2009/8/13
** @author blair mitchelmore
* @version 2.1.6
***/
new function(settings) ;
var parse = function(path) ;
var set = function(target, tokens, value) else if (is(target, object)) else
} else if (token && token.match(/^\s*[0-9]+\s*$/)) else if (token) ;
if (is(target, array)) ;
for (var i = 0; i < target.length; ++i)
target = temp;
}target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value);
} else
return target;
};var queryobject = function(a) ;
if (a.queryobject) );
} else
val = (!val && val !== 0) ? true : val;
if (val !== false && val !== true && typeof val != 'number')
val = val;
self.set(key, val);
});});
}return self;
};queryobject.prototype = ,
get: function(key)
return typeof target == 'number' ? target : target || "";
},get: function(key) , target);
else if (is(target, array))
return target.slice(0);
return target;
},set: function(key, val) ,
set: function(key, val) ,
remove: function(key) ,
remove: function(key) ,
empty: function() );
return self;
},load: function(url) ,
empty: function() ,
copy: function() ,
compact: function() : orig;
if (typeof orig == 'object')
jquery.each(orig, function(key, value) );
}return obj;
}this.keys = build(this.keys);
return this;
},compact: function() ,
tostring: function() ;
var addfields = function(arr, key, value)
arr.push(o.join(""));
};var build = function(obj, base) ;
jquery.each(obj, function(key, value) );
};build(this.keys);
if (chunks.length > 0) querystring.push($hash);
querystring.push(chunks.join($separator));
return querystring.join("");}};
return new queryobject(location.search, location.hash);
};}(jquery.query || {}); // pass in jquery.query as settings object 如果想獲取test,則可以引入外掛程式後,用如下方法獲取:var test = $.query.get('test');如果引數有多個相同的名稱 ,則可以這樣:var arr = $.query.get('testy');輸出: [ 值1 , 值2, 值3...]如果要獲取多個相同名稱中的某乙個,可以這樣:var arrayelement = $.query.get('testy[1]');此外掛程式不僅能獲取引數,也能設定引數。設定乙個引數:var newurl = $.query.set("section", 5).tostring(); 輸出 : "?section=5"設定兩個引數:var newurl = $.query.set("section", 5).set("action", "do").tostring(); 輸出 : "?action=do§ion=5"刪除乙個引數:var oldqueryagain = $.query.remove("type");清空所有引數:var emptyquery = $.query.empty();複製所有引數:var stillthesame = $.query.copy();
jquery 獲取表單內容
獲取一組radio被選中項的值 var item input name items checked val 獲取select被選中項的文字 var item select name items option selected text select下拉框的第二個元素為當前選中值 select id ...
jQuery獲取表單值
獲取所有select值 獲取所有屬性值 var item select name items option selected text select name selectname each function 好記性不如爛筆頭,摘錄一下。jquery radio取值,checkbox取值,selec...
jquery 獲取 表單值
jquery取radio單選按鈕的值 input name items checked val jquery radio取值,checkbox取值,select取值,radio選中,checkbox選中,select選中,及其相關 獲取一組radio被選中項的值 var item input nam...