473,569 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple two numbers then result sum with another number

2 New Member
hi,
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
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="sum.aspx.vb" Inherits="sum" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>sum</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.  
  12.         <table width="auto" border="0" cellspacing="10" cellpadding="2" align="center">            
  13.             <tr>
  14.                 <td colspan="2" align="center"> </td>
  15.             </tr>
  16.  
  17.         </table>
  18.         <table >
  19.           <tr align="center">
  20.                                 <td class="ContentCell">
  21.                                     1</td>
  22.                                 <td class="ContentCell">
  23.                                     Loop</td>
  24.                                 <td class="ContentCell">
  25.                                     171</td>
  26.                                 <td class="ContentCell" align="center">
  27.                                     <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtAdaRate" name="one"
  28.                                         value="171" />
  29.                                 </td>
  30.                             </tr>
  31.                             <tr align="center">
  32.                                 <td class="ContentCell">
  33.                                     2</td>
  34.                                 <td class="ContentCell">
  35.                                     Loop rate</td>
  36.                                 <td class="ContentCell">
  37.                                     115</td>
  38.                                 <td class="ContentCell" align="center">
  39.                                     <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtFixRate" name="two"
  40.                                         value="115" />
  41.                                 </td>
  42.                             </tr>
  43.                             <tr align="center">
  44.                                 <td class="ContentCell">
  45.                                     3</td>
  46.                                 <td class="ContentCell">
  47.                                     Loop bridge </td>
  48.                                 <td class="ContentCell">
  49.                                     1153</td>
  50.                                 <td class="ContentCell" align="center">
  51.                                     <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtBridTap" name="three"
  52.                                         value="1153" />
  53.                                 </td>
  54.                             </tr>
  55.                             <tr align="center">
  56.                                 <td class="ContentCell">
  57.                                     4</td>
  58.                                 <td class="ContentCell">
  59.                                    test</td>
  60.                                 <td class="ContentCell">
  61.                                     45</td>
  62.                                 <td class="ContentCell" align="center">
  63.                                     <input onclick="clickCh(this)" type="checkbox" runat="server" id="txtThroTest" name="four"
  64.                                         value="45" />
  65.                                 </td>
  66.                             </tr>
  67.                             <tr align="center">
  68.                                 <td class="ContentCell">
  69.                                     5</td>
  70.                                 <td class="ContentCell">
  71.                                     Latency test</td>
  72.                                 <td class="ContentCell">
  73.                                     122200</td>
  74.                                 <td class="ContentCell" align="center">
  75.                                 <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);">
  76.                                 <span id="five" style="font-size:12px;">25,000</span>
  77.                                     <input onclick="clickCh(this)" type="checkbox" runat="server" 
  78.                                         name="five" value="session("span.five")" />
  79.                                 </td>
  80.                             </tr>
  81.                             <tr>
  82.                                 <td class="ContentCell" colspan="2" align="center">
  83.  
  84.                                 </td>
  85.                                 <td class="ContentCell" colspan="2">
  86.                                     <input id="total" type="text" name="total" runat="server" readonly="readonly" style="font-family: Tahoma;
  87.                                         font-size: 12px;" />
  88.                                 </td>
  89.                             </tr>
  90.         </table>
  91.         <script language="JavaScript" type="text/javascript">
  92. var total = document.getElementById("total")
  93. function clickCh(caller){
  94. if(caller.checked){
  95. add(caller)
  96. } else {
  97. subtract(caller)
  98. }
  99. }
  100. function add(caller){ total.value = total.value*1 + caller.value*1}
  101. function subtract(caller){ total.value = total.value*1 - caller.value*1}
  102.     </script>
  103.             <script language ="javascript" >
  104.  
  105.         function upPrice(m){
  106.             m=parseInt(m);
  107.             if(m>=0){
  108.                 span=document.getElementById('five');
  109.                 perM=13398948;
  110.                 span.innerHTML=formatNUM((perM*m));
  111.             }else{
  112.                 span.innerHTML='';
  113.             }
  114.         }
  115.         function formatNUM(number) {
  116.                 var nStr = '' + Math.round(parseFloat(number) * 100) / 100;
  117.                 var x = nStr.split('.');
  118.                 var x1 = x[0];
  119.                 var x2 = x.length > 1 ? '.' + x[1] : '';
  120.                 var rgx = /(\d+)(\d{3})/;
  121.                 while (rgx.test(x1)) {
  122.                     x1 = x1.replace(rgx, '$1' + ',' + '$2');
  123.                 }
  124.                 return x1 + x2;
  125.             };
  126.  
  127.         </script>
  128.     </form>
  129. </body>
  130. </html>
Dec 30 '09 #1
5 1979
ThatThatGuy
449 Recognized Expert Contributor
posting such long code snippets will not help...

summarise your point please
Dec 30 '09 #2
merkam
2 New Member
hi,
i need a script that:
step1: multiple n*1200= m
n=0 or 1 or 2 ... user input n
step2: sum m+10+20
such as
10
20
n*1200
sum = 10+20+n*1200
user can select 10 or 20 and input n
Dec 30 '09 #3
ThatThatGuy
449 Recognized Expert Contributor
i doubt its not a home work question.....
and i think bytes has a policy that we don't help school kids with their home work..

that's bcoz you have asked a very simple question... sorry
Dec 30 '09 #4
tlhintoq
3,525 Recognized Expert Specialist
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Dec 30 '09 #5
tlhintoq
3,525 Recognized Expert Specialist
Bytes has a policy regarding assisting students with their homework.

The short version is that the volunteers here can't help you with schoolwork.
A) We don't know what material you have and have not learned in class.
B) We don't know the guidelines you must follow.
C) In the long run giving you the answers actually short changes your education.
Dec 30 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
746
by: cplusplus | last post by:
Hello, I have newbie question. I'm stuck on this current assignment. Write a program that prompts the user for two integer values, passes the values to a function where they are multiplied together and the square root of the product is returned and displayed for the user. The function should return a double. Hint: If you multiply an...
4
8939
by: John Bowman | last post by:
Hi, A couple Q's , so I've come to the experts<g>. 1) I need a definitive answer to the following debate. I've got a couple developers who disagree on the following question. We've got an XML file of numerical data results where it could contain values such as: <RESULT>0.12345</RESULT> when created in English, but it could contain:...
16
2426
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables (se below) then I run a query giving me a running total, which give me the first stock in the batch purchased by an individual, then I use this...
13
4215
by: quickcur | last post by:
Suppose I have a function rand() that can generate one integer random number between 0 and 100. Suppose also rand() is very expensive. What is the fastest way to generate 10 different random number between 0 and 100? (call rand() only 10 times...) Thanks, qq
32
14783
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
17
12754
by: Sri | last post by:
How do you add an n-bit number in C? Regards, Sri
60
4890
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the 'target' programming community herein) to get some community input and verify (or not) the following two statements. Few programmers (3 to7%)...
2
2987
by: pengbsam | last post by:
Hello: I need to write a program that search through multiple level BOM, get all the items. It seems like a easy enough project, but when I put my hands on it and couple of hundred lines of codes later. It starts look more difficult. I was hopeing someone might have a very easy way to do it that I don't know about... The BOM structure looks...
7
16538
by: andrewfsears | last post by:
I have a question: I was wondering if it is possible to simulate the multiple constructors, like in Java (yes, I know that the languages are completely different)? Let's say that I have a class called "Point" which would have two values "x" and "y". Now, let's say if it were the Java version, I would want two constructors: one that...
13
2782
by: Peter Oliphant | last post by:
I would like to be able to create a random number generator that produces evenly distributed random numbers up to given number. For example, I would like to pick a random number less than 100000, or between 0 and 99999 (inclusive). Further, the I want the range to be a variable. Concretely, I would like to create the following method: ...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.