I am trying to create a page using VBScript and ASP that in a loop
outputs a recordset with a checkbox next to each record, each checkbox
named the same. i need to be able to have the client check one of the
boxes and immediately see one of the values of that record in another
frame. when they check another one it adds that ones value to the
previous ones. if they uncheck the box it needs to subtract that
value. all of this has to be done without submitting it. infact i
dont even have it in a form. most of my problems are coming in
because of clientside/serverside issues.
heres the code i have so far:
<% 'vD_BWP_choose.asp takes the budget information given from
vL_query_BWP.asp and
' combines it with information gathered from
' the database into one recordset and uses it to create a table that
allows the
' user to create their own Best Work Package
'
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<!--#include file="resources/script/tp_security.asp"-->
<%
vBudgeted = session("vbudgeted")
vSquareFoot = session("vsquarefoot")
sHull = session("hull")
public sumtotal
sumtotal=0
'creates the record set with all the values
%>
<!--#include file="resources/includes/BWP_createRS.asp"-->
<%
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'recordset created
'create table to view and choose tanks
' Print table header
%>
<table bgcolor='#ffffff' border=1 bordercolor='Black' cellpadding=1
cellspacing=0 width='100%'>
<%' print table
rs.movefirst%>
<tbody>
<%
do while not rs.eof
vtank=rs("tank")
vsides=rs("sides")
vtop=rs("top")
vbottom=rs("bottom")
vtbars=rs("tbars")
vapproxsqft=rs("approx_tank_sq_ft")
vtankcategory=rs("tank_category")
vdrydock=rs("drydock_blasted")
vtotalmoney=rs("totalmoney")
vchecked=rs("checked")
vID=rs("ID")
response.write "<tr>"
response.write "<td align='center' WIDTH=5% ><input type='checkbox'
language='VBScript' name=the checkbox OnClick=Clicked'"&vtotalmoney&"'
></td>"
%>
<td WIDTH=10% ><font class=LittleBlBd><b><img
src=images/redArrow.gif > <a href="vd_tank.asp?t=<%= vtank
%>&H=<%=shull%>" ><%= vtank %></a></b></font></td>
<td WIDTH=5% ><font class=LittleBlBd><b><%= vbottom
%></b></font></td>
<td WIDTH=5% ><font class=LittleBlBd><b><%= vsides
%></b></font></td>
<td WIDTH=5% ><font class=LittleBlBd><b><%= vtop
%></b></font></td>
<td WIDTH=5% ><font class=LittleBlBd><b><%= vtbars
%></b></font></td>
<td WIDTH=10% ><font class=LittleBlBd><b><%= vapproxsqft
%></b></font></td>
<td WIDTH=5% ><font class=LittleBlBd><b><%= vtankcategory
%></b></font></td>
<td WIDTH=10% ><font class=LittleBlBd><b><%= vid %>
</b></font></td>
<td WIDTH=10% ><font class=LittleBlBd><b><%= vtotalmoney %>
</b></font></td>
<%
rs.movenext
loop
%>
</tbody>
</table>
<script language="VBScript">
<!--
sumtotal=0
sub Clicked(vtotalmoney)
'this is where i need to check to see if the checkbox is checked or
not, but it
'doesnt know which one to check i think
'if checkbox.checked then
' sumtotal=sumtotal + vtotalmoney
'else
' sumtotal=sumtotal-vtotalmoney
'end if
'write to the other frame
PARENT.bottom.DOCUMENT.WRITE "<center> Total Money Spent=" &sumtotal&
"</center>"
PARENT.bottom.DOCUMENT.CLOSE
End sub
-->
</script>
<%
rs.close
set rs=nothing%>