Results 1 to 6 of 6

Thread: why does my page keep refreshing?

  1. #1
    Join Date
    Jul 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default why does my page keep refreshing?

    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?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because you have an href. Return false from the event handler to prevent the default action:
    Code:
    <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:
    Code:
    <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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thankyou so much. This whole javascript thing is much diferent than my native c#...

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ugh... you should go ahead and learn Java, C# is just a bad clone.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jul 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    lets not get into that argument, ok?

    ps. did you see that Ken Lay just died?

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hm, no, I hadn't. Interesting.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •