Wednesday, August 05, 2009

JavaScript : GET variable from query string


fullURL = parent.document.URL
GetVar = fullURL.substring(fullURL.indexOf('?')+xxx, fullURL.length)


? = variable name
xxx = length of GET variable name.


Example.

fullURL = parent.document.URL
GetVar = fullURL.substring(fullURL.indexOf('topicid')+7, fullURL.length)

No comments: