A website is under construction. Am struck to a point here:

In the website am building, the clients requirement is that, He offers some works under some payment. So he needs in his services page the kind of drop down list in such a manner that its as below:

say, He offers WEB-DESIGNING is 3 types HTML, Flash and combined one. For HTML he charges Rs.150/page and for Flash Rs.250/page and for combined Rs.200/page (In Indian Rupees). For this I chose 3 Drop down lists:

1. To choose the type of work : Web designing / other works (blah..blah)
2. To choose the type of page : Html / Flash / Combined
3. To choose the no. of pages : 4 / 5 / 6 / 7

then A text field to calculate the sum of amount:
say,
choosing
1. Web designing
2. Combined
3. 4

in text field i should get Rs.800 (becoz 4 X 200 = 800).

How to get this. Pls help me. Thanks in advance to the one who helps me soon.

Recommended Answers

All 2 Replies

Hi Riteman,

It's failry easy to get the "total" from two fields and output it into a third field.

<script type="text/javascript">
function calculateCost() {
var cost = parseInt(document.getElementById("cost").value);
var quantity = parseInt(quantity.getElementById("quantity").value);
var total = parseInt(document.getElementById("total").value);

total.value = cost * quantity;
}
</script>

<input type="text" id="cost" value="200" disabled />
<input type="text" id="quantity" onkeydown="/>
<input type="text" id="total" disabled />

@floatingDivs Thanks for ur reply.. But the code u have specified s useful for me to create a receipt or a bill. But am dealing with the drop down menu.. am having problem there only..! Will pls help me with the question? Thanks 4 ur code...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.