PDA

View Full Version : why does my page keep refreshing?



tim.thelion
07-05-2006, 08:31 PM
when I press contact, the page refreshes resetting the page to home(in firefox). why? http://mysite.verizon.net/res8szeo/pv/default.htm In ie7 it just does not work. why?

Twey
07-05-2006, 08:34 PM
Because you have an href. Return false from the event handler to prevent the default action:
<a href="" id= "main_menu_item_contact" onclick="SelectMenuItem('contact'); return false;">Contact</a>The usual thing to do when no non-JS alternative is available is to link to # or javascript:void(0); like so:
<a href="#" id= "main_menu_item_contact" onclick="SelectMenuItem('contact'); return false;">Contact</a>However, in your case you should link directly to the contact page, or create a seperate contact page to link to here if none exists, and set that as the href so non-JS browsers have somewhere to go.

tim.thelion
07-05-2006, 09:02 PM
Thankyou so much. This whole javascript thing is much diferent than my native c#...

Twey
07-05-2006, 09:27 PM
Ugh... you should go ahead and learn Java, C# is just a bad clone.

tim.thelion
07-05-2006, 09:53 PM
lets not get into that argument, ok?

ps. did you see that Ken Lay just died?

Twey
07-05-2006, 10:53 PM
Hm, no, I hadn't. Interesting.