Forum Moderators: open

Message Too Old, No Replies

empty href causing reload

         

norbiu

10:08 pm on Oct 14, 2006 (gmt 0)

10+ Year Member



Hello, I have a html code that connects to a javascript through a link:

<a href="#_self" onClick="forward()" name="B1">Next</a>

The problems is that when I click next, the link in the address bar changes into link.com/blabla/#_self. If I don't put anything in the href, the page will reload. Is there a way to have a clean address bar and no reload?

Thanks!

tedster

10:19 pm on Oct 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe I'm missing something about your question. It sounds to me like you want a link that doesn't do anything at all. What is the purpose of that?

norbiu

10:23 pm on Oct 14, 2006 (gmt 0)

10+ Year Member



The onClick="forward()" does the whole job. It's an image gallery. I could just remove the href because I don't need it, but then the cursor wouldn't change when I move it over the link. I tried that cursor: hand; in CSS but it didn't work.

encyclo

10:27 pm on Oct 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try:

onclick="forward()[b];return false;[/b]"

Returning false will mean that the browser will not follow the link (unless Javascript is disabled, of course).

norbiu

10:32 pm on Oct 14, 2006 (gmt 0)

10+ Year Member



Cool, it worked. Thank you.