Welcome to WebmasterWorld Guest from 3.93.75.30

Forum Moderators: open

Message Too Old, No Replies

javascript;: v.s. #

How can I ....

     
1:21 pm on Sep 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 12, 2002
posts:1151
votes: 0


When assigning text a swap image function; we must assign the "href" javascript or #.
However, when href=# the page reloads itself. How do I prevent the reload
of the page when # is used. I cannot use the javascript;: as other functions
prevent it from working well.

If you believe you have seen this thread before; you are not experiencing
a "deja vu" - as I deleted it as one of my flags by error.

1:25 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Can you add a dumby function to a javascript: like javascript:noReload(); or is that out of the question?
1:38 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 17, 2001
posts:1262
votes: 0


What errors do the other functions generate?

We use javascript:void(0);

1:41 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 12, 2002
posts:1151
votes: 0


dumby function to a javascript

No can do; I am replacing an image with an animated gif; when I assign
the href with a javascript empty or with a dummy function; the animated
gif does not animate?

1:59 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Have you tried returning false from the dumby function? That should keep the animated gifs working. I believe javascript:void(0); will also keep the gifs running.

function noReload(){
return false;
}

2:56 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 12, 2002
posts:1151
votes: 0


I tried but with no success. The images switches; but it remains on the first
frame of the animated gif?

Is there away of keeping the href=# from reloading the page?

3:03 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 25, 2002
posts:3185
votes: 0


If you are using an event handler like onClick or onMouseOver, you can tell the browser to ignore the defualt action (href= in this case) by adding return false:

<a href="#" onMouseOver="doSomething();return false">

HTH

3:23 pm on Sept 15, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 12, 2002
posts:1151
votes: 0


When I use MouseOver; it works; return false
However I'm using MouseDown. :(
3:47 pm on Sept 15, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 19, 2002
posts:372
votes: 0


# will jump to top of the page
while javascript:; will do nothing (except some browser internal stuffes)

someone said ### will be fine, but i'm not sure how wildly it's supported

does anyone know?

gph

10:00 pm on Sept 15, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 0


Do you need to use an <a> tag?. If it's just the hover affect you want you can use any element. <span> works well at mimicking <a>

<tag class="out" onmouseover="this.className = 'over'" onmouseout="this.className = 'out'"...

Personally I find it less messy than fighting the href.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members