Count total value from scrolldown menus.

Z

ZyPhiX

Hi, I've got a little problem:

I'm trying to make a webpage with a few scrolldown menu's and I want
to count the values of them. In the scrolldown menu's are no numeric
values but the have to represent one. I hope I can explain it a little
bit better:

Scrolldownmenu 1:
- Option A (name A) --> (this has to represent te value 10 for
example)
- Option B (name B) --> (this has to represent te value 32 for
example)

Scrolldownmenu 2:
- Option A (name A) --> (this has to represent te value 15 for
example)
- Option B (name B) --> (this has to represent te value 30 for
example)

etc.. (a few other ones)



So I wanna count the values they represent to a total and put it in a
textfield. And if you select a name that i will add that value to the
total or update it (whitout refreshing the page).

And is it then also possible to give an error message if the total
value is above a specified value?

I think it is possible with javascript but I'm not that experienced.

Hopefully I explained it good enough and someone can help me.


thanks.
 
D

DJ WIce

Maybe you just want to use a free script that is easy to implement and
tested:

http://www.burmees.nl/menu/menus.htm

Wouter

: Hi, I've got a little problem:
:
: I'm trying to make a webpage with a few scrolldown menu's and I want
: to count the values of them. In the scrolldown menu's are no numeric
: values but the have to represent one. I hope I can explain it a little
: bit better:
:
: Scrolldownmenu 1:
: - Option A (name A) --> (this has to represent te value 10 for
: example)
: - Option B (name B) --> (this has to represent te value 32 for
: example)
:
: Scrolldownmenu 2:
: - Option A (name A) --> (this has to represent te value 15 for
: example)
: - Option B (name B) --> (this has to represent te value 30 for
: example)
:
: etc.. (a few other ones)
:
:
:
: So I wanna count the values they represent to a total and put it in a
: textfield. And if you select a name that i will add that value to the
: total or update it (whitout refreshing the page).
:
: And is it then also possible to give an error message if the total
: value is above a specified value?
:
: I think it is possible with javascript but I'm not that experienced.
:
: Hopefully I explained it good enough and someone can help me.
:
:
: thanks.
 
Z

ZyPhiX ZyPhiX

That's not exactly what I'm looking for. I mean something like on this
page:

Maybe "listbox" is a better word?


www.verstappen.nl/NL/item12/2003.html


And then I want to add a value to each option. So I can make a total
sum of the selected values.

Hope it's clear now?
 
@

@SM

ZyPhiX a ecrit :
I'm trying to make a webpage with a few scrolldown menu's and I want
to count the values of them. In the scrolldown menu's are no numeric
values but the have to represent one. I hope I can explain it a little
bit better:

to add the value of row (1st row, 2nd, 3rd etc) in field "MyTotal"
and
to add the values of options in field "BigTotal"

<html>
<script type="text/javascript"><!--
function getRowNumber(MyMenu,Field1,Field2) {
if(document.all) {
r = document.Field1;
c = document.Field2;
t = document.all['MyTotal'];
tt = document.all['BigTotal'];
}
else
if(document.getElementsByName) {
r = document.getElementsByName(Field1)[0];
c = document.getElementsByName(Field2)[0];
t = document.getElementsByName('MyTotal')[0];
tt = document.getElementsByName('BigTotal')[0];
}
else {
r = document.forms['MyForm'].elements[Field1];
c = document.forms['MyForm'].elements[Field2];
t = document.forms['MyForm'].elements['MyTotal'];
tt = document.forms['MyForm'].elements['BigTotal'];
}
r.value = MyMenu.options.selectedIndex+1*1;
t.value = t.value*1+r.value*1;
c.value = MyMenu.options[MyMenu.options.selectedIndex].value;
tt.value = tt.value*1+c.value*1;
if(tt.value>150) alert('That\'s too much !');
}

// --></script>

<form name="MyForm">
<p><select name="Scrolldownmenu_1"
onchange="if(this.options.selectedIndex>0)
getRowNumber(this,'showR_1','showV_1');">
<option>Choice 1
<option value="5">A
<option value="3">B
</select>
<br>choosen Row 1 :<input type=text name="showR_1">
<br>choosen Value 1 :<input type=text name="showV_1">
<p><select name="Scrolldownmenu_2"
onchange="if(this.options.selectedIndex>0)
getRowNumber(this,'showR_2','showV_2');">
<option>Choice 2
<option value="15">A
<option value="31">B
</select>
<br>choosen Row 2 :<input type=text name="showR_2">
<br>choosen Value 2 :<input type=text name="showV_2">
<p>Total rows : <input type=text name="MyTotal">
Total values : <input type=text name="BigTotal">
</form>
</html>

--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:[email protected]
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
**************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top