I'm trying to write a script that will pass the url of the current page to the 'stumbleupon' site to be bookmarked.
My script is:
<script type="text/javascript">
function getHost()
{
var url = window.location.href;
var bookmarkpart1='<a href="
document.write(bookmarkpart1+url+'"> <img border=0 src=""**LINK TO stumbleit.gif**"" alt="StumbleUpon Toolbar"> Stumble It!</a>')
}
</script>
<script type="text/javascript">
getHost();
</script>
Unfortunately it's for some reason not writing the value of the variables (bookmarkpart1 and url but writes them as string on the page.
What am I doing wrong???
if I call it with for example
<body onload="getHost()">
</body>
it works fine but that's not how I want it.
Any help would be much appreciated.
Pav
My script is:
<script type="text/javascript">
function getHost()
{
var url = window.location.href;
var bookmarkpart1='<a href="
document.write(bookmarkpart1+url+'"> <img border=0 src=""**LINK TO stumbleit.gif**"" alt="StumbleUpon Toolbar"> Stumble It!</a>')
}
</script>
<script type="text/javascript">
getHost();
</script>
Unfortunately it's for some reason not writing the value of the variables (bookmarkpart1 and url but writes them as string on the page.
What am I doing wrong???
if I call it with for example
<body onload="getHost()">
</body>
it works fine but that's not how I want it.
Any help would be much appreciated.
Pav