SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    jigga jigga what? slider's Avatar
    Join Date
    Oct 2002
    Location
    Utah (USA)
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    checkbox onclick reload page?

    I'm a total n00b to JavaScript (haven't written a single snippet of it yet ). I was wondering how hard it would be to have a checkbox cause the page to be reloaded if it was checked or unchecked.
    Code:
    <input type="checkbox" />
    Is JS the best way to do this?
    $slider = 'n00b';

  2. #2
    jigga jigga what? slider's Avatar
    Join Date
    Oct 2002
    Location
    Utah (USA)
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forgot to mention I also want to include the new value for the checkbox in a POST or GET so it will be updated in my database (PHP stuffs will handle that).
    $slider = 'n00b';

  3. #3
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="checkbox" onclick="if(this.checked){this.form.submit();}"/> ?

  4. #4
    jigga jigga what? slider's Avatar
    Join Date
    Oct 2002
    Location
    Utah (USA)
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks mano... will that also work on an "uncheck"? Past bedtime, will try it out tomorrow.
    $slider = 'n00b';

  5. #5
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just remove the if...
    <input type="checkbox" onclick="this.form.submit()"/>


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
  •