Dr. Oz wrote:
> 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>")
Several problems.
(1) To join two strings in JavaScript you use a plus sign. An ampersand is,
I assume, a bitwise AND operator.
(2) You didn't close your first string, nor open your last
(3) You don't have anything to join the last string to the output of the
getQueryVariable function.
You probably want something like:
document.write('<a href="prod_request.html?id=' + getQueryVariable('x') +
'">Prod | </a>');
(And as a couple of side notes. First, it looks like you might be depending
on JavaScript, this isn't a good idea - especially when you can achieve the
same effect with 100% reliability on the server side. Secondly, if you want
a list of links, it is far better to mark them up as a list (i.e. with
<ul>/<ol> and <li>) and them style them rather then putting pipe characters
between them. Its better food for search engines, screen readers, etc.)
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
|