Forum Moderators: open
I need to send the URL of the current page as a parameter to another page. I'm doing it through a link, here's how I'm building the link:
function thispage()
{
var thelink="If you liked this page, and would like to send it to a friend,";
thelink += "<a href='http://www.example.com/sendpage.php?refer_url=" + location.href;
thelink +="'>click here!</a>";
document.write(thelink);
}
And in the HTML body, I call the function like this:
<script>thispage();</script>
But it doesn't work. Am I being too naive to think that would work without calling it from an 'event' like OnClick or somethign?
Please help!
cheers
thelink +="'>click here!</a>";
...got an orphan in there. Make JS die with an unterminated string literal I would think. Fix that and you should be good to go. :)
Jordan
Ps. I mean it needs to be in the same line, like...
thelink += "<a href='http://www.example.com/sendpage.php?refer_url=" + location.href +
"'>click here!</a>";