Retrieve a query string variable from the current page
From Market Ruler Help
Revision as of 02:10, 17 September 2009 by Admin (talk | contribs) (Created page with 'Retrieves the value of a Query String from the current page's query string. <code>''string'' CR_QS(''variable-name'', ''default-value'');</code> * ''variable-n…')
Retrieves the value of a Query String from the current page's query string.
string CR_QS(variable-name, default-value);
- variable-name - The name of the query string variable to retrieve
- default-value - If not found, return this value instead.
- returns the string value of the query string variable
Example:
For example, if the current page URL is:
http://www.example.com/?productId=124123&crsource=Google&offset=20&index=1&wrap=true
Then the following code:
<script type="text/javascript">
Will output the text "124123" and "no department" to the current page.
document.write(CR_QS('productId'));
document.write(CR_QS('departmentId','no department'));
</script>