dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: Javascrip - on/ off button

  1. #1
    Join Date
    Jun 2011
    Posts
    5

    Question Javascrip - on/ off button

    Hi i am in the middle of creating a members area system which has went well up to now. I need to create a button that will turn alerts on and off for example when the user clicks the button it will show turn on and vice versa however each time they select the button i want it to update the database with its current state so the admin knows who is currently accepting alerts. IS THIS POSSIBLE!!!!

    I would like to thank you in advance and appreciate any help.

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    It is possible. You can use JavaScript to both alter the innerHTML text between ON and OFF, and access an AJaX function that can submit information to a page that will update the table in the database. You can even set it up so that it waits for the return text before changing the ON or OFF display on the page.

  3. #3
    Join Date
    Jun 2011
    Posts
    5
    Thanks for the prompt reply, would you have any idea of how to do this or could you point me in the right direction.

  4. #4
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    set a cookie of alerts on/off.
    this accomplish two of your goals:
    1. remembering the pref
    2. making the pref available to the server (using the backend cookie feature)

    you'll have to ask on a different forums about committing the various cookies to a DB, that's backend talk...

  5. #5
    Join Date
    Jun 2011
    Posts
    5
    thanks, i have the code to change the button from on to off and vice versa, i will ask elsewhere how to update server thanks for your responses

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles