?
Solved

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

Posted on 2004-08-01
4
Medium Priority
?
249 Views
Last Modified: 2010-05-02
<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>
0
Comment
Question by:Johnny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 11690743
function CheckSome(){
    document.frmChecks.chkCheck_3.checked = true
    checkBoxes(document.frmChecks.chkCheck_3);
    document.frmChecks.chkCheck_5.checked = true;
    checkBoxes(document.frmChecks.chkCheck_5);;
}
0
 
LVL 33

Accepted Solution

by:
sajuks earned 2000 total points
ID: 11690745
the whole script,
<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(document.frmChecks.chkCheck_3);
    document.frmChecks.chkCheck_5.checked = true;
    checkBoxes(document.frmChecks.chkCheck_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>
0
 

Author Comment

by:Johnny
ID: 11690817
thank you for posting the complete script too...

i couldnt figure it out

thanks alot
0
 
LVL 33

Expert Comment

by:sajuks
ID: 11691003
Thanks for the points and grade
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question