PDA

View Full Version : Form help



Timbo
18-08-2006, 05:37 PM
I've got this form... Can some one help me out?:D




<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Form<t>
</head>

<body>

<table border="0" cellpadding="3" cellspacing="3" style="border-style:none; border-collapse: collapse; font-family:Verdana; font-size:10pt" bordercolor="#111111" width="13%" id="table1" fpstyle="14,011111100" height="89">
<tr>
<td width="27%" style="font-weight: normal; color: black; border-style: none; background-color: #000080" height="16" align="right">
<font color="#FFFFFF"><b>Item</b></font></td>
<td width="21%" style="font-weight: normal; color: black; border-style: none; background-color: #000080" height="16" align="right">
<font color="#FFFFFF"><b>Cost</b></font></td>
<td width="35%" style="font-weight: normal; color: black; border-style: none; background-color: #000080" height="16" align="right">
<font color="#FFFFFF"><b>Quantity</b></font></td>
</tr>
<tr>
<td width="27%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
hot dogs</td>
<td width="21%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
$1.75</td>
<td width="35%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
&nbsp;<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." --><INPUT TYPE="text" NAME="KS_HDF" VALUE="0" SIZE="3"></td>
</tr>
<tr>
<td width="27%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
chips</td>
<td width="21%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
$2</td>
<td width="35%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
&nbsp;<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." --><INPUT TYPE="text" NAME="KS_HD" VALUE="0" SIZE="3"></td>
</tr>
<tr>
<td width="27%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
Cheese burger</td>
<td width="21%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
$2.50</td>
<td width="35%" style="font-weight: normal; color: black; border-style: none; background-color: #B4CACA" height="16" align="right">
&nbsp;<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." --><INPUT TYPE="text" NAME="KS_LD" VALUE="0" SIZE="3"></td>
</tr>
<tr>
<td width="30%" style="padding:0; font-weight: normal; color: #000000; background-color: #B4CACA; border-top-style:dashed; border-top-width:3px; border-bottom-style:double; border-bottom-width:3px" height="16" align="right">

Total</TD>


<td width="24%" style="padding:0; font-weight: normal; color: #000000; background-color: #B4CACA; border-top-style:dashed; border-top-width:3px; border-bottom-style:double; border-bottom-width:3px" height="16" align="right">

</TD>


<td width="39%" style="padding:0; font-weight: normal; color: #000000; background-color: #B4CACA; border-top-style:dashed; border-top-width:3px; border-bottom-style:double; border-bottom-width:3px" height="16" align="right">

&nbsp;<INPUT TYPE="text" NAME="scAMOUNT" VALUE="00.01" SIZE="6">&nbsp; </TD>


</tr>
</table>
<p>How do I make the total box show the total of quantity * cost for all of
the above rows?</p>
<p>... and how do I make the digits right aligned?</p>
<p>&nbsp;</p>

</body>

</html>

Greg
19-08-2006, 11:04 AM
I've got this form... Can some one help me out?:D
It would help to know exactly what you want help with?

stu161204
19-08-2006, 12:56 PM
Welcome to PressF1 Timbo :)

It would of helped if you did not put your question in to the html code ;)


<p>How do I make the total box show the total of quantity * cost for all of
the above rows?</p>
<p>... and how do I make the digits right aligned?</p>
<p>&nbsp;</p>

Timbo
19-08-2006, 07:58 PM
Thanks stu161204. :o

Just copy the code and save it in a txt file as .html.

Any one have any idea how I can do this? EDIT: The form thing.

Erayd
20-08-2006, 03:53 PM
Just copy the code and save it in a txt file as .html.I don't know about you, but most people can't be bothered doing this just to view your question - you're more likely to be ignored. Next time put the question in plain text please.

How to right-align the digits: You will need to set the text-align attribute for the input boxes. You can either do this inline with <input style="text-align: right;" />, or you can add it to your stylesheet (if you have one).

How to update the total: You will need to use javascript for this. Set an id for each input, and then write a function to deal with them. Use getElementByID().value to get the values in the boxes, add them all up, and set the total's value. This function should be triggered by the onChange event for the total box. It may also pay to make the total box read-only.

Timbo
20-08-2006, 06:14 PM
Thanks for the reply Bletch,

I don't know javascript:(. Can you make a working example for me?

Timbo
22-08-2006, 12:39 AM
Anyone with the know how? :D

Rob99
22-08-2006, 02:25 AM
With javascript; you will need to create a function to do the math ie.add box1 to box2, you will also need to place a button to execute the math function.

You would place the javascript in the head and call it when needed.

I'll have a wee play.

Rob99
22-08-2006, 02:48 AM
http://www.imagef1.net.nz/files/addition.htm

Erayd
24-08-2006, 02:33 PM
No need to use a button to trigger the function - it looks nicer if you use the onChange or one of the onKey events for box1 and box2.

Rob99
24-08-2006, 04:56 PM
Like this
http://www.imagef1.net.nz/files/addition1.htm
or this
http://www.imagef1.net.nz/files/addition2.htm