homepage Welcome to WebmasterWorld Guest from 54.167.185.110
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

    
Javascript:void(0) not working, but does on other sites
Arjen




msg:1492839
 2:41 pm on Mar 2, 2003 (gmt 0)

Hello

My (commercial) website has a pagerank of 7. I am doing a friend of mine a favour by linking to him (non-commercial site) on my frontpage so his traffic will increase.

Because I don't want to get penalized by his pagerank so I decided to use the following javascript link. As far as I know this will not be followed by the robots.

<a href="javascript:void(0)" onclick="window.open('http://www.widget.com')">Widgets</a>

But for some reason the javascript:void(0) part is not working. I always thougth this would return a value of 0 and the link won't work, but the onclick will open the target website in a new window.

But instead the javascript:void(0) returns a 404 error.

I've checked this in tutorials and they do it the same way and it does work. Widgets.com is opened in a new window.

Am I missing something?

 

Birdman




msg:1492840
 2:53 pm on Mar 2, 2003 (gmt 0)

How about:

<script type="javascript">
document.write("<a target='_blank' href='ht*tp://www.your_buddies_site.com'>Check out my buddies' site</a>");
</script>

Arjen




msg:1492841
 2:55 pm on Mar 2, 2003 (gmt 0)

Thanks!

I am going to try that straight away.

Birdman




msg:1492842
 3:14 pm on Mar 2, 2003 (gmt 0)

I believe you can do it like this too:

<a href="javascript: Location.href("http://www.site.com")">

ikbenhet1




msg:1492843
 3:16 pm on Mar 2, 2003 (gmt 0)


Yes that'll work.

This too:

<a href="javascript:void(0)" onclick="window.open('http://www.widget.com');return false;">Widgets</a>

<a href="" onclick="window.open('http://www.widget.com');return false;">Widgets</a>

macrost




msg:1492844
 4:40 pm on Mar 4, 2003 (gmt 0)

I know that is an (kinda) old posting, but you can do it this way also.

<head>
<script language="javascript">
function popwin(){
newwin = window.open( "/window.html", "newwin", 'width=390,height=500,resizable=1,scrollbars=yes');
}
</script>
</head>
<body>
<a href="javascript:void(0);" onclick="javascript:popwin();">click me</a>
</body>

Mac

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