i need a script that:
step1: multiple n*1200= m
n=0 or 1 or 2 ...
step2: sum m+10+20
i have this script
i don't now how to assign span with id="five" to value in checkbox plz help me
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="sum.aspx.vb" Inherits="sum" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>sum</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <table width="auto" border="0" cellspacing="10" cellpadding="2" align="center">
- <tr>
- <td colspan="2" align="center"> </td>
- </tr>
- </table>
- <table >
- <tr align="center">
- <td class="ContentCell">
- 1</td>
- <td class="ContentCell">
- Loop</td>
- <td class="ContentCell">
- 171</td>
- <td class="ContentCell" align="center">
- <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtAdaRate" name="one"
- value="171" />
- </td>
- </tr>
- <tr align="center">
- <td class="ContentCell">
- 2</td>
- <td class="ContentCell">
- Loop rate</td>
- <td class="ContentCell">
- 115</td>
- <td class="ContentCell" align="center">
- <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtFixRate" name="two"
- value="115" />
- </td>
- </tr>
- <tr align="center">
- <td class="ContentCell">
- 3</td>
- <td class="ContentCell">
- Loop bridge </td>
- <td class="ContentCell">
- 1153</td>
- <td class="ContentCell" align="center">
- <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtBridTap" name="three"
- value="1153" />
- </td>
- </tr>
- <tr align="center">
- <td class="ContentCell">
- 4</td>
- <td class="ContentCell">
- test</td>
- <td class="ContentCell">
- 45</td>
- <td class="ContentCell" align="center">
- <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtThroTest" name="four"
- value="45" />
- </td>
- </tr>
- <tr align="center">
- <td class="ContentCell">
- 5</td>
- <td class="ContentCell">
- Latency test</td>
- <td class="ContentCell">
- 122200</td>
- <td class="ContentCell" align="center">
- <input type="text" name="mah" id="Text1" size="4" value="1" border="0" style="font-size:16px;font-weight:bold;align:center" onchange="upPrice(this.value);" onkeyup="upPrice(this.value);">
- <span id="five" style="font-size:12px;">25,000</span>
- <input onclick="clickCh(this)" type="checkbox" runat="server"
- name="five" value="session("span.five")" />
- </td>
- </tr>
- <tr>
- <td class="ContentCell" colspan="2" align="center">
- </td>
- <td class="ContentCell" colspan="2">
- <input id="total" type="text" name="total" runat="server" readonly="readonly" style="font-family: Tahoma;
- font-size: 12px;" />
- </td>
- </tr>
- </table>
- <script language="JavaScript" type="text/javascript">
- var total = document.getElementById("total")
- function clickCh(caller){
- if(caller.checked){
- add(caller)
- } else {
- subtract(caller)
- }
- }
- function add(caller){ total.value = total.value*1 + caller.value*1}
- function subtract(caller){ total.value = total.value*1 - caller.value*1}
- </script>
- <script language ="javascript" >
- function upPrice(m){
- m=parseInt(m);
- if(m>=0){
- span=document.getElementById('five');
- perM=13398948;
- span.innerHTML=formatNUM((perM*m));
- }else{
- span.innerHTML='';
- }
- }
- function formatNUM(number) {
- var nStr = '' + Math.round(parseFloat(number) * 100) / 100;
- var x = nStr.split('.');
- var x1 = x[0];
- var x2 = x.length > 1 ? '.' + x[1] : '';
- var rgx = /(\d+)(\d{3})/;
- while (rgx.test(x1)) {
- x1 = x1.replace(rgx, '$1' + ',' + '$2');
- }
- return x1 + x2;
- };
- </script>
- </form>
- </body>
- </html>