Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with JS "check all/ uncheck all" box

    New here and not a JS wizard (at all). I need to get two little buttons working for check all/uncheck all on a form list. When I isolate the script on this page:
    http://www.hotelfandb.com/subscribe/hot-leads-test.htm
    the buttons work.

    When call this form from another page it does not, even when I put the script in the head file (topnew-copy.asp)
    Here's the one those same buttons won't work on:
    http://www.hotelfandb.com/subscribe/...yfree-test.asp

    Does anyone have any ideas why, and how to get around it?

    Help is much appreciated!

  • #2
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Use a validator to fix your HTML.

    You can't just drop a whole HTML page, including doctype and all, right into the middle of another HTML page and expect it to work.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unfortunately its not up to me - I didn't design the page, just being asked to make the check box work. The hot leads file it is calling in is in several pages. Should it be an asp file instead? (basically, what can I do to get the javascript to work?)

  • #4
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Basically, you're nesting two forms, which is not allowed, so the browser won't see the inner form, which you are trying to access using Javascript. What you could do is access those checkboxes as elements of the outer form instead. I won't go into more detail, though, since this is not the right way to fix this. Validating the HTML is.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback


  •  

    Posting Permissions

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