Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Reading url using javascript



7:35 pm on Sep 24, 2009 (gmt 0)

5+ Year Member

Hi guys,
I'm trying to read the URL of the page using javascript, this is what I am trying and it doesnt work.

<a href="JavaScript:document.write(window.location.href);"
<img src="images/socialicons/Icons/facebook.png"
style="vertical-align: middle;" alt="Facebook"
title="share on Facebook" /> Facebook

Can someone please tell me how to do this right?

Thank you.


8:14 pm on Sep 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Try replacing the first line with:

<script type="text/javascript>
document.write('<a href="' +
window.location.href + '" style="text-decoration:none;">');

Featured Threads

Hot Threads This Week

Hot Threads This Month