PDA

View Full Version : document.getElementById('MyLink').href is this possible?



boemboem
06-19-2009, 02:50 PM
I wonder if this is possible, the document.getElementById('MyLink').href I mean. At first sight it doesn't work, but maybe I did something wrong with the quotes or something.

Any help would be great :)


<script type="text/javascript">

function changeLink()
{
document.getElementById('MyLink').innerHTML="Bookmark me!";
document.getElementById('MyLink').href="javascript:document.write('<html><head><title>{$txt_short_url}</title></head><body><form name=\'urlform\' action=\'{$short_url}\' method=\'post\'><input type=\'hidden\' name=\'u\' value=\'' + window.location.href + '\' /></form></body></html>');document.forms[0].submit()";
document.getElementById('MyLink').target="_blank";
}
</script>


<body onload changeLink();>

<a id="MyLink" href="http://www.JustaLink.com">Just A Link</a>

abduraooft
06-19-2009, 02:56 PM
onload="changeLink();"
btw, let me ask, what's your ultimate goal?

Philip M
06-20-2009, 07:30 AM
onload="changeLink();"
btw, let me ask, what's your ultimate goal?

Joost mag het weten.

boemboem
06-20-2009, 10:12 AM
Philip, beetje ver van huis vriend ;) Won je in London of spoof je dat :D

In this way I want to thank everyone for making my goals possible.

@ Philip, Kor and ofcourse tomws :thumbsup:

This is what I wanted to do, and with all your help I managed to do so.

http://twiturl.nl (notice the image in top of the page :D)

The only thing now is the different placement of the div's in Iexplorer, but that's an other department in CodingForums. :D

Thank you'll

Philip M
06-20-2009, 10:46 AM
Philip, beetje ver van huis vriend ;) Won je in London of spoof je dat :D



Eigenlijk woon ik in een mooie buitenwijk ongeveer 50km van London. Vroeger heb ik in Nederland en Belgie enkele jaren gewerkt.