473,804 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Operation Adding up var values of checked radiabuttons

2 New Member
Hi there,
I am supposed to do a shop ... which I ve done so far. The only thing that I can't get working is adding up to get the result

It would be really great if someone could help me (Sorry it is in GERMAN)
ThX in advance
Sansasoon

[HTML] <html>
<head>
<title>Warenkor b berechnen</title>
<script language="Javas cript">
<!--
function fensteropen() {
var fenster=window. open("fenster.h tml", "zweites", "width=430,heig ht=120,status=y es,toolbar=no") ;
}
//--></script>
</head>
<body bgcolor="#CC000 0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" >
<div align="center"> <font size="6">Warenk orb berechnen </font></div>
<div align="center">
<p><font size="5">Bitte w&auml;hlen Sie aus, welche Pizzen wir Ihnen liefern
sollen:</font></p>
<table width="492" cellspacing="5" cellpadding="5" border="1" height="230" bgcolor="#FFAF0 9">
<form>
<tr>
<td width="66">
<input type="checkbox" value="checkbox ">
</td>
<td width="144"><fo nt size="4">Pizza Napoli</font></td>
<td width="126"><fo nt size="4">&euro; 5,55</font></td>
<td rowspan="8" width="77"><img src="../bilder/aktion.jpg" width="146" height="200"></td>
</tr>
<tr>
<td width="66">
<input type="checkbox" value="checkbox ">
</td>
<td width="144"><fo nt size="4">Pizza Funghi</font></td>
<td width="126"><fo nt size="4">&euro; 5,95</font></td>
</tr>
<tr>
<td width="66">
<input type="checkbox" value="checkbox ">
</td>
<td width="144"><fo nt size="4">Pizza-Salami</font></td>
<td width="126"><fo nt size="4">&euro; 6,15</font></td>
</tr>
<tr>
<td width="66">
<input type="checkbox" value="checkbox ">
</td>
<td width="144"><fo nt size="4">Pizza Calzone</font></td>
<td width="126"><fo nt size="4">&euro; 7,45</font></td>
</tr>
<tr>
<td width="66">
<input type="checkbox" value="checkbox ">
</td>
<td width="144"><fo nt size="4">Gr&uum l;ner Salat</font></td>
<td width="126"><fo nt size="4">&euro; 5,05</font></td>
</tr>
<tr>
<td colspan="2"><fo nt size="4">Summe gesamt in &euro;</font></td>
<td width="126">
<input type="text" >
</td>
</tr>
<tr>
<td colspan="2"> <font size="4">
<input type="button" name="Button" value=" Jetzt berechnen ">
</font> </td>
<td width="126">
<input type="reset" name="Button2" value=" Zur&uuml;ck ">
</td>
</tr>
<tr>
<td colspan="2">&nb sp;</td>
<td width="126">&nb sp;</td>
</tr>
</form>
</table>
<p><font size="5">Aktion swoche: Bestellen Sie drei Aktions-Pizzen zum Preis
von einer!<br>
N&auml;here Informationen zu unserem Angebot erhalten Sie</font>
<a href="#" onClick="fenste ropen()"><font size="5">hier</font></a>.</p>
</div>
</body>
</html>[/HTML]
Feb 29 '08 #1
5 1666
hsriat
1,654 Recognized Expert Top Contributor
German is not a problem, but can you please edit your post and add [html] in the starting and [/html] in the end of your HTML code?

That helps people out here to find the problem quickly.
Feb 29 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future. Thanks!

Moderator.
Feb 29 '08 #3
Sansasoon
2 New Member
Hi,
how can I edit my Question?
ThX Sansoon


Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future. Thanks!

Moderator.
Feb 29 '08 #4
hsriat
1,654 Recognized Expert Top Contributor
Unfortunately, there are lots of things missing in your code.

You may have a look at the following tutorial first:If the problem would still persist, we are here to help you out.
Feb 29 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Hi,
how can I edit my Question?
ThX Sansoon
Don't worry, I've added the code tags for you. Just remember to use them next time you post code.

As for your question, you need to access the numbers in some way. I assume that you want to total the items for which the checkboxes are checked. The best thing to do in this situation is to set the value of each checkbox to the number it represents. Then get each checked checkbox and add the numbers up.

To get all the checkboxes, use document.getEle mentsByTagName( "input"). Then loop over the checkboxes and check that they are checked. If so, add to the total.
Feb 29 '08 #6

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

Similar topics

5
2694
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one function to verify the name fields, age, email and gender. My question is: if I create a function for each field like the code below, what would be the best way to organize the functions and call them? Would I need one main function and place...
1
1672
by: Steve | last post by:
Hmm, I know you can use javascript in the address bar to display alert messages and misc. stuff like that. But when I try and control some forms it loadsa a new page for the loaded example... eg. javascript: document.forms.elements.checked=true; would load a blank page with 'true' written on it, is there a way to make
3
4889
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
3
11128
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
1
4240
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get the example to work. I created the following two classes, provided with the example: *-*-**-*-*-*-*-*-*-*-*-*-**-*-*-*-*-CheckBoxColumn Class:-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-**-*-*-*
36
2100
by: Robert Baer | last post by:
I used Google and found some references for integer in Java. But "int" not only does not work, it also prevents reading X and Y coordinates of the mouse. What i would like to do: 1) Get X and Y mouse coordinates into a variable that i can do real math on. So far, i can do math on the values "read" and that result goes into a "variable" that is useful *only* for display. If i try "int" in that math, the values are then zero for everything...
6
2532
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
13
39449
by: Oleg Konovalov | last post by:
Hi, I am working on a web application which among other things uses DHTML, Java and Javascript. It populates web page based on the contents of the database (resultset), and next to each row there is a checkbox (v1) allowing to select that row for changes (e.g. delete, update, etc.) So we are creating an array of checkbox, correct ? Of course I have to check whether any of these checkboxes exist and if any of them got selected (checked)
3
2021
by: norbit | last post by:
Hello, I’m new to learning JavaScript. I was trying out a simple script but I can’t seem to make it work: <HTML><HEAD><TITLE>Radio Buttons</TITLE> <SCRIPT language=JavaScript> function process()
0
9711
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9591
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10331
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10087
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7631
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.