|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am interested in having two drop down lists on a page so a person can select a country from each list, click submit, and a phone rate will be automatically calculated and displayed for the user.
Any help would be completely appreciated. - Damien ------------------ www.international01.com |
|
#2
|
|||
|
|||
|
URLI've used this script, to do a similar calculation, and I think it'll do for you.
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!--hide code from old browsers function get_rate () { if (document.rates.from.options[document.rates.from.selectedIndex].value !="none") { if (document.rates.to.options[document.rates.to.selectedIndex].value !="none") { var rate_from = eval(document.rates.from.options[document.rates.from.selectedIndex].value); var rate_to = eval(document.rates.to.options[document.rates.to.selectedIndex].value); var rate = eval(rate_from + rate_to); alert("Call costs $"+rate+" per minute"); } else { alert("Please select countries."); } } else { alert("Please select countries."); } } //end hiding--> </SCRIPT> </HEAD> <BODY> <FORM NAME="rates"> <SELECT NAME="from" SIZE="1"> <OPTION VALUE="none">calling from <OPTION VALUE="0.10">country 1 <OPTION VALUE="0.20">country 2 <OPTION VALUE="0.30">country 3 <OPTION VALUE="0.40">country 4 </SELECT> <SELECT NAME="to" SIZE="1"> <OPTION VALUE="none">calling to <OPTION VALUE="0.10">country 1 <OPTION VALUE="0.20">country 2 <OPTION VALUE="0.30">country 3 <OPTION VALUE="0.40">country 4 </SELECT> <BR> <INPUT TYPE="button" VALUE="calculate rate" onClick="get_rate()"> </FORM> </BODY> </HTML> Hope it helps. Christine. |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > drop down lists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|