获取get值:
<body>
<form action="9.26获取get值.html" method="get">
<input type="text" name="t1" />
<input type="text" name="t2" />
<input type="radio" name="r1" value="1" />
<input type="radio" name="r1" value="0" />
<select name="s1">
<option>a</option>
<option>b</option>
<option>c</option>
</select>
<input type="submit" />
</form>
</body>
<script>
var url_ = window.location + ‘‘;
var index = url_.indexOf("?");
var get = [];
if(index != -1) {
var str = url_.substring(index+1,url_.length);
var arr = str.split(‘&‘);
for(var i=0;i<arr.length;i++){
get[arr[i].split(‘=‘)[0]]=arr[i].split(‘=‘)[1];
}
}
for(var x in get){
document.write(x + ‘=‘ + get[x] + "<br>");
}
</script>
例题: