I realize that my post is too long. So this is the code after trimming and
commenting: (I use finaltotal array because string or number cannot be passed
by reference to cffunction)
<!--Function to increase total by 20 if checkbox is checked-->
<cffunction name="increasetotal" output="no">
<cfargument name="finaltotal" type="array">
<cfset temp1 = session.finaltotal[1] + 20>
<cfset ArraySet( ARGUMENTS.finaltotal,1,1, temp1 ) />
<cfreturn ARGUMENTS.finaltotal[1]>
</cffunction>
<!--Function to decrease total by 20 if checkbox is unchecked-->
<cffunction name="decreasetotal" output="no">
<cfargument name="finaltotal" type="array">
<cfset temp2 = ARGUMENTS.finaltotal[1] - 10>
<cfset ArraySet( ARGUMENTS.finaltotal,1,1, temp2 ) />
<cfreturn ARGUMENTS.finaltotal[1]>
</cffunction>
<!--Javascript to be called onClick-->
<script>
<cfoutput>
function hello(checkboxes, index)
{
checkbox = checkboxes[index];
if(!checkbox) {
checkbox = checkboxes;
}
var temp = 0;
if(checkbox.checked) {
temp = #increasetotal(session.finaltotal)#;
} else if (!checkbox.checked){
temp = #decreasetotal(session.finaltotal)#;
}
window.location.reload();
}
</cfoutput>
</script>
<!--HTML containing checkbox-->
<html><head><title></title></head>
<body>
<cfoutput>
<cfform NAME="listForm" METHOD="POST"
ACTION="http://www.annistonmorningrotary.org/temp/confirmpremium.cfm">
<table border=1>
<tr><td><cfinput type="checkbox" name="chosenSite" value="1"
onclick="javascript:hello(document.listForm.chosenSite, 0);"/>
</table>
</cfform>
</cfoutput>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255001
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4