Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdown menus to calculate price

Status
Not open for further replies.

lucidtech

IS-IT--Management
Jan 17, 2005
267
US
I was wondering if this was possible :

I have a dropdown menu inside a form in Coldfusion. Is there a way to update page information based on what the user clicks.

So.. if the user selects a certain type of shipping, can I then update a price variable that is on the screen immediately, or does this have to be done with Javascript. Basically, what I am looking for is a listener function for when the user chooses an item from the drop down menu.
 
yes, that is done with javascript, without a form submission to the server

(that's how "ajax" works)

maybe ask in the javascript forum?



r937.com | rudy.ca
 
you mean like this?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Please Login ...</title>
<style type="text/css">
.focus {border: 2px solid;border-style:dashed;background-color:#FFFFFF; color:#777777;
border-color: #429252 #5aba4a #63df52 #5aba4a; padding:3px;}
#container {background-color:#eeeeee; width:60%; height:60%; border:1px dashed #777777; padding:2em; }
#font1 {font-family:Geneva, Arial, Helvetica, sans-serif; font-size:x-small; }
.normal { background-color:#FFFFFF; color:#777777; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:x-small; }
</style>
<script language="javascript" type="text/javascript">
function changeShipping(tF)
{
document.getElementById('shipping').innerHTML = tF;
}
</script>
</head>
<body background="background.jpg">
<div id="container" align="center">
<form name="form1" method="post" action="">
<table width="305" height="121" border="0">
<tr>
<td width="24">&nbsp;</td>
<td width="194" align="right">country </td>
<td width="65">
<select name="shipping" onChange="changeShipping(this.value);">
<option value="0">Select</option>
<option value="30">USA</option>
<option value="45">Canada</option>
<option value="36">Mexico</option>
</select> </td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right">shipping cost :</td>
<td id="shipping">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</div>
</body>
</html>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top