homepage Welcome to WebmasterWorld Guest from 54.197.110.151
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Reading url using javascript
vikasvrao

5+ Year Member



 
Msg#: 3995166 posted 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);"
style="text-decoration:none;">
<img src="images/socialicons/Icons/facebook.png"
style="vertical-align: middle;" alt="Facebook"
title="share on Facebook" /> Facebook
</a>

Can someone please tell me how to do this right?

Thank you.

 

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3995166 posted 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;">');
</script>

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