homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Reading url using javascript

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

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)

Try replacing the first line with:

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved