Link to home
Start Free TrialLog in
Avatar of Johnny
JohnnyFlag for United States of America

asked on

vbscript: i keep getting an error with this and i dont know why..any help would be great thanks

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Check Boxes</title>
<script>
function checkAll(objCheck){
     objForm = document.forms[0];
     if(objCheck.checked){
          bolChecked = true;
     }else{
          bolChecked = false;
     }
     for(i=0;i<objForm.elements.length;i++){
        if(objForm.elements[i].type=="checkbox"){
                  objForm.elements[i].checked = bolChecked;
         }
     }
}

function checkBoxes (chkBox) {
  var theCheckBox="chkBox"+chkBox.id;
  if(chkBox.checked) {
    document.getElementById(theCheckBox).innerHTML='Install';
  }else{
    document.getElementById(theCheckBox).innerHTML='Do Not Install';
  }
}

function CheckSome(){
    document.frmChecks.chkCheck_3.checked = true;
    checkBoxes("3");
    document.frmChecks.chkCheck_5.checked = true;
    checkBoxes("5");
}

function pageInit(){
  CheckSome();
}
</script>

</head>
<body onLoad=pageInit()>

<td>
<form action="http://www.fairfieldconsulting.com/processForm.asp" method="post" name="frmChecks" id="frmChecks">

  <input id="1" type="checkbox"  name="chkCheck_1" onclick="checkBoxes(this)"><span id="chkBox1">Do Not Install this program 1</span>
  <br>
  <input id="2" type="checkbox"  name="chkCheck_2" onclick="checkBoxes(this)"><span id="chkBox2">Do Not Install</span>
  <br>
  <input id="3" type="checkbox"  name="chkCheck_3" onclick="checkBoxes(this)"><span id="chkBox3">Do Not Install</span>
  <br>
  <input id="4" type="checkbox"  name="chkCheck_4" onclick="checkBoxes(this)"><span id="chkBox4">Do Not Install</span>
  <br>
  <input id="5" type="checkbox"  name="chkCheck_5" onclick="checkBoxes(this)"><span id="chkBox5">Do Not Install</span>
  <br><br>
  <input type="checkbox" name="chkCheck" value="" onClick="checkAll(this)">Check / Uncheck All<br />
  <br>
  <input type=button onClick="CheckSome()" value="Default">
  <input name="Reset" type="reset" onclick="checkBoxes(this)">
  <input name="MySubmit" type="submit" onClick="VBScript:MsgBox('Submitted!')">
</form>
</td>

</body>
</html>
Avatar of sajuks
sajuks

function CheckSome(){
    document.frmChecks.chkCheck_3.checked = true
    checkBoxes(document.frmChecks.chkCheck_3);
    document.frmChecks.chkCheck_5.checked = true;
    checkBoxes(document.frmChecks.chkCheck_5);;
}
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johnny

ASKER

thank you for posting the complete script too...

i couldnt figure it out

thanks alot
Thanks for the points and grade