D
Dr. Oz
Hi,
I am trying to read in a query string from one page and build a link to
another page based on the query string.
Here's the code I am using to read in the query string:
<script "text/javascript">
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars.split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
</script>
This works fine.
I can print out the query sting value using document.write:
document.write( getQueryVariable("x") );
But when I try to add the query string to a link using document.write
it doesn't work:
document.write("<a href='prod_request.html?id=' &
getQueryVariable('x')>Prod | </a>")
I am trying to read in a query string from one page and build a link to
another page based on the query string.
Here's the code I am using to read in the query string:
<script "text/javascript">
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars.split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
</script>
This works fine.
I can print out the query sting value using document.write:
document.write( getQueryVariable("x") );
But when I try to add the query string to a link using document.write
it doesn't work:
document.write("<a href='prod_request.html?id=' &
getQueryVariable('x')>Prod | </a>")