• Nike free run 2 pink
  • Nike free 5.0 kids
  • Oakley sunglasses discount
  • CodeAve.com CodeAve.com - JavaScript - Forms
    ASP
    JavaScript
    ·Document Info
    ·Forms
    ·Images
    ·Miscellaneous
    ·Navigation
    ·Script Writers
    ·Contents
    ·What's New?
    CSS
    HTML
    Maps
    Links
    Mail List
    Search
    Sitemap


     

  • Retro 3 jordans
  • Jordan 13 retro
  • Nike free 5.0

  • Checkbox Input Validation
  • Air jordan 11 low
  • New Balance 996
  • Ray ban vintage sunglasses
  • Checkboxes are a great way to get directed input from people using your site. Sometimes you may want to limit the amount of checkboxes that can be selected at any one time.  In this example we're mimicking a portion of a Major League Baseball All-Star ballot. Each year fans get to choose three outfielders from a list from each league.  The following will replicate that allowing only three entries to be selected from a list of some of the best outfielders ever. A simple loop checks each checkbox value for input, tallies up a count that were selected, and a couple of simple tautologies will display an appropriate message depending on the input.
    View the Output
    Text View
    Print View
    Mail this Link
    Download the Code

    <html>
    <title>CodeAve.com(Checkbox Input Validation)</title>
    <body bgcolor="#FFFFFF">

    <script Language="JavaScript">
    <!--
    function checkbox_checker()
    {

    // set var checkbox_choices to zero

    var checkbox_choices = 0;

    // Loop from zero to the one minus the number of checkbox button selections
    for (counter = 0; counter < checkbox_form.checkbox.length; counter++)
    {

    // If a checkbox has been selected it will return true
    // (If not it will return false)
    if (checkbox_form.checkbox[counter].checked)
    { checkbox_choices = checkbox_choices + 1; }

    }


    if (checkbox_choices > 3 )
    {
    // If there were more than three selections made display an alert box
    msg="You're limited to only three selections.\n"
    msg=msg + "You have made " + checkbox_choices + " selections.\n"
    msg=msg + "Please remove " + (checkbox_choices-3) + " selection(s)."
    alert(msg)
    return (false);
    }


    if (checkbox_choices < 3 )
    {
    // If there were less then selections made display an alert box
    alert("Please make three selections. \n" + checkbox_choices + " entered so far.")
    return (false);
    }

    // If three were selected then display an alert box stating input was OK
    alert(" *** Valid input of three outfielders was entered. ***");
    return (true);
    }

    -->
    </script>



    <form method="get" action="#"
    onsubmit="return checkbox_checker()" name="checkbox_form">
    <input type="checkbox" value="Hank Aaron" name="checkbox">Hank Aaron<br>
    <input type="checkbox" value="Ted Williams" name="checkbox">Ted Williams<br>
    <input type="checkbox" value="Hank Greenberg" name="checkbox">Hank Greenberg<br>
    <input type="checkbox" value="Stan Musial" name="checkbox">Stan Musial<br>
    <input type="checkbox" value="Willie Mays" name="checkbox">Willie Mays<br>
    <input type="checkbox" value="Joe DiMaggio" name="checkbox">Joe DiMaggio<br>
    <input type="checkbox" value="Ricky Henderson" name="checkbox">Ricky Henderson<br>
    <input type="checkbox" value="Barry Bonds" name="checkbox">Barry Bonds<br>
    <input type="checkbox" value="Curt Flood" name="checkbox">Curt Flood<br>
    <input type="checkbox" value="Roger Maris" name="checkbox">Roger Maris<br>
    <input type="checkbox" value="Reggie Jackson" name="checkbox">Reggie Jackson<br>
    <input type="checkbox" value="Kirk Gibson" name="checkbox">Kirk Gibson<br>
    <input type="checkbox" value="Tony Gwynn" name="checkbox">Tony Gwynn<br>
    <input type="checkbox" value="George Foster" name="checkbox">George Foster<br>
    <input type="checkbox" value="Andre Dawson" name="checkbox">Andre Dawson<br>
    <input type="submit" value="Submit">
    </form>

    </body>
    </html>

     

     

     



    ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
    Server Variables | Response Objects | Random Events | Miscellaneous
    HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
    JavaScript: Document Info | Forms | Images | Navigation | Script Writers
    CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

    jordan 11 gamma Nike KD VI lebron 11 low