[Javascript] Can someone help me.
Scott.Wiseman
swiseman at remax-cahi.com
Thu Mar 7 13:36:39 CST 2002
here is the code....
if there is a '' in the checked assignment
I get a check box...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<SCRIPT LANGUAGE="javascript">
<!--
//==========================================================================
===========
//========================Gather Default Values of the
Form============================
//==========================================================================
===========
startvals = new Array(); //data from db
function GatherDefaultInfo()
{
for ( i=0; i <myform.elements.length; i++ )
{
startvals[myform.elements[i].name] = myform.elements[i].value ;
}
}
function DO_Update()
{
WhatHasChanged();
document.myform.agentquota.checked
='<%=request.form("agentquota")%>';
document.myform.confidential.checked
='<%=request.form("Confidential")%>';
document.myform.daf.checked
='<%=request.form("daf")%>';
document.myform.commercial.checked
='<%=request.form("commercial")%>';
document.myform.resortprop.checked
='<%=request.form("resortprop")%>';
document.myform.metro.checked
='<%=request.form("metro")%>';
document.myform.printonlabel.checked
='<%=request.form("printonlabel")%>';
document.myform.printonroster.checked
='<%=request.form("printonroster")%>';
//==========================================================================
===========
//=================Checking the Form for Check Boxes that have been clicked
===========
//==========================================================================
===========
for ( i=0; i <myform.elements.length; i++ )
{ //checking code
if(myform.elements[i].type=="checkbox")
{
alert('checkbox '+myform.elements[i].name + '
'+myform.elements[i].checked);
if(myform.elements[i].checked == false)
{
alert("check box is false");
// myform.elements[i].checked='false';
myform.elements[i].value='OFF';
}
}
}
//==========================================================================
===========
//==========================================================================
===========
//==========================================================================
===========
return true;
}
//==========================================================================
===========
//======================ON-CHANGE EVENT with the
checkboxes============================
//==========================================================================
===========
function checkbox_click(thecheckbox)
{
alert(thecheckbox.checked);
// if (thecheckbox.checked==true)
// { thecheckbox.checked}
// if (thecheckbox.checked==false)
// { thecheckbox.checked="false"}
}
//==========================================================================
===========
//=Loop through the start array and then compare it against the end array
============
//==========================================================================
===========
function WhatHasChanged()
{
endvals = new Array(); //data from db
//=============================================
// Collect end values before database update
//=============================================
for ( i=0; i<myform.elements.length; i++ )
{ endvals[myform.elements[i].name] = myform.elements[i].value ; }
//===================================================
// Test for Change on text,drop down and check boxes
//===================================================
for ( i=0; i<myform.elements.length; i++ ) // test for change
{
if(myform.elements[i].type!="textarea")
{
if(myform.elements[i].defaultChecked != myform.elements[i].checked)
{
alert(myform.elements[i].name + ' default: '+
myform.elements[i].defaultChecked + ' Checkbox after: '+
myform.elements[i].checked );
}
if( startvals[myform.elements[i].name] !=
endvals[myform.elements[i].name] )
{
alert(startvals[myform.elements[i].name] + '
'+endvals[myform.elements[i].name]);
}
} // if loop
} //for
} //function
//==========================================================================
===========
//==========================================================================
===========
//==========================================================================
===========
//-->
</SCRIPT>
<title>New Page 3</title>
</head>
<body onLoad="GatherDefaultInfo();" >
<form name="myform" method="POST" action="theformtest.asp"
<table border="1" width="617" height="205">
<table>
<tr>
<td width="88" height="19">D.A.F.</td>
<td width="55" align="center" height="19"><input type="checkbox"
name="daf" checked='' value="ON"></td>
</tr>
<tr>
<td width="88" height="19">Commercial</td>
<td width="55" align="center" height="19"><input type="checkbox"
name="commercial" checked='<%request.form("commercial")%>' value="ON"></td>
</tr>
<tr>
<td width="88" height="19">Confidential</td>
<td width="55" align="center" height="19"><input type="checkbox"
name="confidential" checked='<%=request.form("confidential")%>'
value="ON"></td>
</tr>
<tr>
<td width="88" height="1">Metro</td>
<td width="55" align="center" height="1"><input type="checkbox"
name="metro" checked='<%=request.form("metro")%>' value="ON"></td>
</tr>
<tr>
<td width="88" height="1">Resort Prop</td>
<td width="55" align="center" height="1"><input type="checkbox"
name="resortprop" checked='<%=request.form("resortprop")%>'
value="ON"></td>
</tr>
<tr>
<td width="88" height="17">Agent Quota</td>
<td width="55" align="center" height="17"><input type="checkbox"
name="agentquota" checked='<%=request.form("agentquota")%>'value="ON"></td>
</tr>
<tr>
<td width="88" height="17">Print Label</td>
<td width="55" align="center" height="17"><input type="checkbox"
name="printonlabel" checked='<%=request.form("printonlabel")%>'
value="ON"></td>
</tr>
<tr>
<td width="88" height="17">Print Roster </td>
<td width="55" align="center" height="17"><input type="checkbox"
name="printonroster" checked='<%=request.form("printonroster")%>'
value="ON"></td>
</tr>
<tr>
<td width="88" height="17">
<p><input type="submit" value="Submit" onclick="DO_Update();"
name="B1"></p>
</td>
<td width="55" align="center" height="17"></td>
</tr>
</table>
</form>
</body>
</html>
-----Original Message-----
From: Scott Mowry [mailto:Scott_A_Mowry at yahoo.com]
Sent: Wednesday, March 06, 2002 8:56 PM
To: javascript at LaTech.edu
Subject: Re: [Javascript] Can someone help me.
Peter,
I like to read the code and work through it on my own. Do I have to
post things to recieve the email???
Scott
----- Original Message -----
From: "Peter Brunone" <peter at brunone.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, March 06, 2002 9:44 PM
Subject: RE: [Javascript] Can someone help me.
> Scott,
>
> What exactly do you want to do?
>
> Cheers,
>
> Peter
>
> |-----Original Message-----
> |From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
> |Behalf Of Scott.Wiseman
> |Sent: Wednesday, March 06, 2002 9:13 PM
> |To: 'javascript at LaTech.edu'
> |Subject: [Javascript] Can someone help me.
> |
> |
> |
> |==================================================================
> | document.myform.agentquota.checked ='ON';
> | document.myform.confidential.checked ='ON';
> | document.myform.daf.checked ='ON';
> | document.myform.commercial.checked ='ON';
> | document.myform.resortprop.checked ='ON';
> | document.myform.metro.checked ='ON';
> |==================================================================
> |------Why does this have a checkbox in it-----
> | document.myform.printonlabel.checked ='';
> | document.myform.printonroster.checked ='';
> |==================================================================
> |_______________________________________________
> |Javascript mailing list
> |Javascript at LaTech.edu
> |https://lists.LaTech.edu/mailman/listinfo/javascript
> |
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list