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
239 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 500 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Computer crashes, following error message in event manager 5 315
Copy a row 12 75
Protecting vb6 & .Net code Obfuscation 18 210
clicking a shape in a frame array vb6 3 54
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

737 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