two values for a checkbox
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: two values for a checkbox

  1. #1
    Join Date
    May 2011
    Posts
    23

    two values for a checkbox

    Hello, I was wanting to know the best way to have a checkbox give a duel value..

    example say I have a check box called "comicbook" and I also have a checkbox called "single" and one called "pack"

    What i would like is
    if "single" is checked then value of comicbook is 5
    if "pack" is checked then value of comicbook is 10
    if both are checked then comicbook would pass both 5 and 10

    any idea's?
    thanks

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,840

    Re: two values for a checkbox

    It's just a simple 4 tier if...elseif...else statement.

    Code:
    var comicbook;
    if (!single && !pack) {comicbook = 0;}
    else if (single && !pack) {comicbook = 5;}
    else if (!single && pack) {comicbook = 10;}
    else {comicbook = 15;}
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center