Results 1 to 4 of 4

Thread: How to enable javascript if checkbox selected

  1. #1
    Join Date
    Feb 2009
    Posts
    69

    How to enable javascript if checkbox selected

    I have inserted some 2 or 3 check boxes in to my web application when I wanted to set the validation on each check box, the check box should give the portability that once any one of check box has been selected the other two options should get checked automatically, Is it possible to enable with my application.

  2. #2
    Join Date
    Jan 2009
    Posts
    143

    Re: How to enable javascript if checkbox selected

    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. This may come in handy during form validation.
    Code:
    function CheckNewRequest() {
       var boolIsChecked = w.indefinite.checked;
       if (w.disksize.options[w.disksize.selectedIndex].value.length < 1) {
              alert("Please select the Disk Size you are requesting to use");
              w.disksize.focus();
              return false;
       }

  3. #3
    Join Date
    Oct 2008
    Posts
    107

    Re: How to enable javascript if checkbox selected

    A check box has a checked property, which returns either a 0 for not checked and a 1 for checked. You can also set the property to 0 or 1 to programmatically control the check box. 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.

  4. #4
    Join Date
    Jan 2009
    Posts
    96

    Re: How to enable javascript if checkbox selected

    The HTML INPUT tag, with "checkbox" as the value of the TYPE attribute. For a given form, the JavaScript runtime engine creates appropriate Checkbox objects and puts these objects in the elements array of the corresponding Form object.
    Code:
    function checkCheckBoxes() {
    	if (document.frmTest.CHKBOX_1.checked == false &&
    	    document.frmTest.CHKBOX_2.checked == false &&
    	    document.frmTest.CHKBOX_3.checked == false)
    		{
    		alert ('You didn\'t choose any of the checkboxes!');
    		return false;
    		}
    	else
    		{
    		return true;
    		}
    	}

Similar Threads

  1. How to enable javascript in IE8
    By roshan45 in forum Technology & Internet
    Replies: 4
    Last Post: 26-10-2009, 08:23 PM
  2. Enable Android Javascript
    By Mind It in forum Software Development
    Replies: 2
    Last Post: 21-09-2009, 03:07 PM
  3. How to enable Javascript in PHP
    By Rebella in forum Software Development
    Replies: 3
    Last Post: 12-05-2009, 11:52 PM
  4. i need to enable javascript
    By ben4147 in forum Windows Update
    Replies: 10
    Last Post: 06-05-2008, 09:15 PM
  5. Where is in IE 7 enable/disable javascript?
    By Jack in forum Vista Help
    Replies: 3
    Last Post: 06-04-2007, 06:14 AM

Tags for this Thread

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
  •  
Page generated in 1,751,381,579.05315 seconds with 16 queries