Welcome to WebmasterWorld Guest from 54.166.87.123

Forum Moderators: open

Message Too Old, No Replies

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

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

10+ Year Member



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?

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

WebmasterWorld Senior Member 10+ Year Member



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>

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

10+ Year Member



Thanks!

I am going to try that straight away.

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

WebmasterWorld Senior Member 10+ Year Member



I believe you can do it like this too:

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

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

10+ Year Member




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>

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

10+ Year Member



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