Hello
Try this:
<script>
var str="http://www.test.org/test.html?a=1&b=2&c=3"
var str1=str.substr(str.indexOf('?')+1) // get the string part that goes
//after the
question mark 'a=1&b=2&c=3'
var arr= new Array()
arr=str1.split(/&/) // str1 is split by
'&' into array arr=('a=1', 'b=2', 'c=3')
var arr1= new Array()
for(var i=0; i<arr.length; i++){
var arr2= new Array()
arr2=arr[i].split(/=/) // same as above, e.g.
arr3=('a', '1') or ('b', '2') or ('c', '3')
arr1.push(arr2[0]) // arr1=('a', 'b', 'c')
}
document.write(arr1[0]+' '+arr1[1]+' '+arr1[2])
</script>
Andrey
"Aaron Gray" <an****@beeb.net> сообщил/сообщила в новостях следующее:
news:cm*******************@news.demon.co.uk...
Hi,
I need to get the web pages URL parameters sent to the web page.
eg :-
http://www.test.org/test.html?a=1&b=2&c=3
How do I get a, b, and c from JavaScript ?
Aaron