Loop through URL GET variables with javascript -
Loop through URL GET variables with javascript -
i know can obtain url variable calling geturlvars()["id"], there way (an unknown number of) variables in url? few reasons allowed on client side.
try this:
function geturlvars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); for(var = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars[hash[0]] = hash[1]; } homecoming vars; } var url_vars = geturlvars(); for(var in url_vars) { alert(i + " == " + url_vars[i]); } javascript url get
Comments
Post a Comment