Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15555 > unrolled thread

Sum of several fields using parseInt differs from that of using a calculator

Started byjustaguy <lichunshen84@gmail.com>
First post2012-08-25 06:18 -0700
Last post2012-08-25 12:44 -0700
Articles 20 on this page of 24 — 10 participants

Back to article view | Back to comp.lang.javascript


Contents

  Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 06:18 -0700
    Re: Sum of several fields using parseInt differs from that of using a calculator Martin Honnen <mahotrash@yahoo.de> - 2012-08-25 15:39 +0200
      Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 09:27 -0700
        Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-25 18:53 +0000
        Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 11:13 +0200
      Re: Sum of several fields using parseInt differs from that of using a calculator Dr J R Stockton <reply1234@merlyn.demon.co.uk.invalid> - 2012-08-26 18:54 +0100
    Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-25 20:39 +0200
      Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-25 14:07 -0700
        Re: Sum of several fields using parseInt differs from that of using a calculator Martin Honnen <mahotrash@yahoo.de> - 2012-08-26 11:23 +0200
        Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 11:27 +0200
          Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-26 06:26 -0700
            Re: Sum of several fields using parseInt differs from that of using a calculator justaguy <lichunshen84@gmail.com> - 2012-08-26 08:48 -0700
            Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 20:55 +0200
            Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 20:50 +0000
              Re: Sum of several fields using parseInt differs from that of using a calculator "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-08-26 21:30 +0000
                Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 22:29 +0000
              Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-26 23:32 +0200
                Re: Sum of several fields using parseInt differs from that of using a calculator Denis McMahon <denismfmcmahon@gmail.com> - 2012-08-26 22:39 +0000
                  Re: Sum of several fields using parseInt differs from that of using a calculator SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-08-27 04:23 +0200
              Re: Sum of several fields using parseInt differs from that of using a calculator Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-08-27 11:09 -0600
                Re: Sum of several fields using parseInt differs from that of using a calculator Stefan Weiss <krewecherl@gmail.com> - 2012-08-28 02:14 +0200
                  Re: Sum of several fields using parseInt differs from that of using a calculator Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-28 14:53 +0200
                    Re: Sum of several fields using parseInt differs from that of using a calculator Martin Leese <please@see.Web.for.e-mail.INVALID> - 2012-08-28 11:29 -0600
    Re: Sum of several fields using parseInt differs from that of using a calculator "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-08-25 12:44 -0700

Page 1 of 2  [1] 2  Next page →


#15555 — Sum of several fields using parseInt differs from that of using a calculator

Fromjustaguy <lichunshen84@gmail.com>
Date2012-08-25 06:18 -0700
SubjectSum of several fields using parseInt differs from that of using a calculator
Message-ID<24572a83-a8c2-4e00-99b2-383206781c09@d13g2000yqm.googlegroups.com>
Hi,

I have several form fields (line items) that I need to add up to a
total, using parseInt(fieldName.value,10) to add them up
for the following values:
2992

450

1015.75

90

1200

returns 5837, however, using a calculator it returns 5747.75.
How come?  Also, I don't know if the number would have decimal
beforehand.  How can we use parseInt or other similar javascript
function to perform such calculation?

Thanks in advance.


[toc] | [next] | [standalone]


#15557

FromMartin Honnen <mahotrash@yahoo.de>
Date2012-08-25 15:39 +0200
Message-ID<5038d580$0$6633$9b4e6d93@newsspool2.arcor-online.net>
In reply to#15555
justaguy wrote:

> I have several form fields (line items) that I need to add up to a
> total, using parseInt(fieldName.value,10) to add them up
> for the following values:
> 2992
>
> 450
>
> 1015.75
>
> 90
>
> 1200
>
> returns 5837, however, using a calculator it returns 5747.75.
> How come?  Also, I don't know if the number would have decimal
> beforehand.  How can we use parseInt or other similar javascript
> function to perform such calculation?


Use parseFloat(field.value) if there can be floating point numbers like 
1015.75 input in the field.


-- 

	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

[toc] | [prev] | [next] | [standalone]


#15558

Fromjustaguy <lichunshen84@gmail.com>
Date2012-08-25 09:27 -0700
Message-ID<746171f8-4d40-489b-9474-bb342190d3b2@o8g2000yqm.googlegroups.com>
In reply to#15557
On Aug 25, 9:39 am, Martin Honnen <mahotr...@yahoo.de> wrote:
> justaguy wrote:
> > I have several form fields (line items) that I need to add up to a
> > total, using parseInt(fieldName.value,10) to add them up
> > for the following values:
> > 2992
>
> > 450
>
> > 1015.75
>
> > 90
>
> > 1200
>
> > returns 5837, however, using a calculator it returns 5747.75.
> > How come?  Also, I don't know if the number would have decimal
> > beforehand.  How can we use parseInt or other similar javascript
> > function to perform such calculation?
>
> Use parseFloat(field.value) if there can be floating point numbers like
> 1015.75 input in the field.
>
> --
>
>         Martin Honnen --- MVP Data Platform Development
>        http://msmvps.com/blogs/martin_honnen/

Good idea, thanks.  And yet, the new total exceeds 6000.  Here's a
little more info,
each field total is calculated by quantity (user input) and price (of
money datatype from a SQL Server 2005 database), which is pulled from
the db and the dynamic calculation of each field_total is perfectly
correct (quantity * {eachFieldName}), yes, each fieldFieldName is
unique.  And the javascript event trigger is OnMouseOut for the
quantity field.

And since we don't know how many fields/rows a user would want, so,
each field name for quantity, price and total is dynamically assigned,
such as
quantity2, price2, total2
quantity3, price3, total3
...

The FORM's first row has fields like this:
quantity, price, total

then, a loop for dynamic {fieldnames}.

Prior to the loop, I have a hidden form field, which has a preset
value of 0, and then,
inside the loop, at the quantity{n} field, on onMouseOut event
trigger, I set the hidden form field value to theField + total{n}, and
calculate the overall Total to initial total + accumulated total,
that is,
document.getElementById('hField').value =
parseFloat(document.getElementById('hField').value) +
parseFloat(document.getElementById('total#n#').value);
document.getElementById('totalFin').value=
parseFloat(document.getElementById('hField').value) +
parseFloat(document.getElementById('total').value);






[toc] | [prev] | [next] | [standalone]


#15560

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-08-25 18:53 +0000
Message-ID<k1b6uf$akq$1@dont-email.me>
In reply to#15558
On Sat, 25 Aug 2012 09:27:26 -0700, justaguy wrote:

> Good idea, thanks.  And yet, the new total exceeds 6000.  Here's a
> little more info,

Please don't drip feed us like this.

Generate a static web page with javascript that demonstrates your 
problem, put it on a public server, and post a link to it.

Then we can see what you're actually doing (which for many people turns 
out not to be what they tell the group they think they're doing) and work 
through your actual code to understand why the results you get are not 
what you expect.

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#15567

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-26 11:13 +0200
Message-ID<5039e8c1$0$6181$ba4acef3@reader.news.orange.fr>
In reply to#15558
Le 25/08/12 18:27, justaguy a écrit :
>
> And since we don't know how many fields/rows a user would want, so,
> each field name for quantity, price and total is dynamically assigned,
> such as
> quantity2, price2, total2
> quantity3, price3, total3

so it's again more easy


function ajout (what) {
var f = what.form,
     total = f.total,
     n = f.length,
     row,
     c = 0;
total.value=0;
while(n--) if(f[n].name.indexOf('st_')>=0) {
     row = f[n].parentNode;
     while(row.tagName.toLowerCase() != 'p') row = row.parentNode;
     row = row.getElementsByTagName('input');
     if(row[1].value>0) row[2].value = c = row[0].value * row[1].value;
     total.value = total.value*1 + c;
     }
}


<p>
Art. 1: <input type="text" name="a_01">
Quantity: <input type="text" name="q_01" onblur="ajout(this)">
Sub total: <input type="text" name="st_01">
</p><p>
Art. 2: <input type="text" name="a_02">
Quantity: <input type="text" name="q_02" onblur="ajout(this)">
Sub total: <input type="text" name="st_02">
</p><p>
Art. 3: <input type="text" name="a_03">
Quantity: <input type="text" name="q_03" onblur="ajout(this)">
Sub total: <input type="text" name="st_03">
</p>
<p>
Total : <input type="text" name="total">
<p>


-- 
Stéphane Moriaux avec/with iMac-intel

[toc] | [prev] | [next] | [standalone]


#15585

FromDr J R Stockton <reply1234@merlyn.demon.co.uk.invalid>
Date2012-08-26 18:54 +0100
Message-ID<yGfDINJ+KmOQFwsE@invalid.uk.co.demon.merlyn.invalid>
In reply to#15557
In comp.lang.javascript message <5038d580$0$6633$9b4e6d93@newsspool2.arc
or-online.net>, Sat, 25 Aug 2012 15:39:12, Martin Honnen
<mahotrash@yahoo.de> posted:

>Use parseFloat(field.value) if there can be floating point numbers like
>1015.75 input in the field.

I prefer something more like
        var NameOfField1 = + field1.value
        var NameOfField2 = + field2.value
        // ...
        Total = NameOfField1 + NameOfField2
assuming that the fields contain only the number and maybe leading &
trailing whitespace.

-- 
 (c) John Stockton, nr London UK               Reply address via Home Page.
   news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
   <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
   <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

[toc] | [prev] | [next] | [standalone]


#15559

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-25 20:39 +0200
Message-ID<50391bc8$0$6183$ba4acef3@reader.news.orange.fr>
In reply to#15555
Le 25/08/12 15:18, justaguy a écrit :
> Hi,
>
> I have several form fields (line items) that I need to add up to a
> total, using parseInt(fieldName.value,10) to add them up
> for the following values:
> 2992
>
> 450
>
> 1015.75
>
> 90
>
> 1200

and simply
  total = fieldName1.value*1 + fieldName2.value*1 + ...
?


function ajout (form, fields, result) {
var f = form.elements, n = f.length, c = 0;
while(n--) if(f[n].name.indexOf(fields)>0)
	c += f[n].value.replace(',','.') *1;
result.value = c;
}

item 1: <input type="text" name="fieldName1"
        onblur="ajout(this.form, 'fieldName', 'total')"><br>
item 2: <input type="text" name="fieldName2"
        onblur="ajout(this.form, 'fieldName', 'total')"><br>
item 3: <input type="text" name="fieldName3"
        onblur="ajout(this.form, 'fieldName', 'total')"><br>

Total : <input type="text" name="total">

-- 
Stéphane Moriaux avec/with iMac-intel

[toc] | [prev] | [next] | [standalone]


#15562

Fromjustaguy <lichunshen84@gmail.com>
Date2012-08-25 14:07 -0700
Message-ID<5c08b4d4-5162-4580-9c9e-d23937e046e2@z17g2000yqk.googlegroups.com>
In reply to#15559
On Aug 25, 2:39 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 25/08/12 15:18, justaguy a écrit :
>
> > Hi,
>
> > I have several form fields (line items) that I need to add up to a
> > total, using parseInt(fieldName.value,10) to add them up
> > for the following values:
> > 2992
>
> > 450
>
> > 1015.75
>
> > 90
>
> > 1200
>
> and simply
>   total = fieldName1.value*1 + fieldName2.value*1 + ...
> ?
>
> function ajout (form, fields, result) {
> var f = form.elements, n = f.length, c = 0;
> while(n--) if(f[n].name.indexOf(fields)>0)
>         c += f[n].value.replace(',','.') *1;
> result.value = c;
>
> }
>
> item 1: <input type="text" name="fieldName1"
>         onblur="ajout(this.form, 'fieldName', 'total')"><br>
> item 2: <input type="text" name="fieldName2"
>         onblur="ajout(this.form, 'fieldName', 'total')"><br>
> item 3: <input type="text" name="fieldName3"
>         onblur="ajout(this.form, 'fieldName', 'total')"><br>
>
> Total : <input type="text" name="total">
>
> --
> Stéphane Moriaux avec/with iMac-intel

Thanks Stéphane, in the meantime, parseFloat solves the problem,
previously I must have moved the curse twice something on the quantity
field, also, I wonder if the onMouseOut event trigger is the best
option for this or would onBlur work better for this?

[toc] | [prev] | [next] | [standalone]


#15568

FromMartin Honnen <mahotrash@yahoo.de>
Date2012-08-26 11:23 +0200
Message-ID<5039eaf4$0$6567$9b4e6d93@newsspool4.arcor-online.net>
In reply to#15562
justaguy wrote:

> previously I must have moved the curse twice something on the quantity
> field, also, I wonder if the onMouseOut event trigger is the best
> option for this or would onBlur work better for this?

onchange 
(http://www.w3.org/TR/html5/common-input-element-apis.html#event-input-change) 
seems the right one in my opinion or for more fine grained, quicker 
reaction oninput 
(http://www.w3.org/TR/html5/common-input-element-apis.html#event-input-input)


-- 

	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

[toc] | [prev] | [next] | [standalone]


#15569

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-26 11:27 +0200
Message-ID<5039ec17$0$6192$ba4acef3@reader.news.orange.fr>
In reply to#15562
Le 25/08/12 23:07, justaguy a écrit :
> I must have moved the curse twice something on the quantity
> field

Don't understand too much ... Goole tells me that 'curse' is :
verb : to damn / swear / crown / abuse / inveigh / insult ...
name : malediction,  imprecation, misfortune, scourge, evil, calamity...


I think that with textfields in a form the onblur is appropriate
(somehow works as a validation, works fine when using keyboard to browse 
along the form (accessibility), ie: tab key )

More, you could add tabindexes to quantity textfields to help visitor

-- 
Stéphane Moriaux avec/with iMac-intel

[toc] | [prev] | [next] | [standalone]


#15570

Fromjustaguy <lichunshen84@gmail.com>
Date2012-08-26 06:26 -0700
Message-ID<1e52efa2-bcfe-45f6-a005-608614428fbb@k3g2000yqo.googlegroups.com>
In reply to#15569
On Aug 26, 5:27 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
> Le 25/08/12 23:07, justaguy a crit :
>
> > I must have moved the curse twice something on the quantity
> > field
>
> Don't understand too much ... Goole tells me that 'curse' is :
> verb : to damn / swear / crown / abuse / inveigh / insult ...
> name : malediction,  imprecation, misfortune, scourge, evil, calamity...
>
> I think that with textfields in a form the onblur is appropriate
> (somehow works as a validation, works fine when using keyboard to browse
> along the form (accessibility), ie: tab key )
>
> More, you could add tabindexes to quantity textfields to help visitor
>
> --
> St phane Moriaux avec/with iMac-intel

Sorry, I meant "cursor".

Back to what a poster mentioned earlier about posting the entire
rendered HTML form here.  Here we go.  We still have a problem when a
user goes back to change a quantity, then subtotal changes, total
changes, and we don't know if the quantity is increased or decreased.
Please copy/paste the following FORM to take a look.  Many thanks.


<html>
<head>
<title>Quotation</title>

</head>

<body bgcolor="lightblue">

<h1 align="center">Quotation</h1>

<form action="ProcessQuote.cfm" method="post">

<table width="85%" align="center">
<tr>
<td ROWSPAN=2>
123 Sunrise blvd, XYZ City, XX 12345 <br/>
Phone: xxx-xxx-xxxx <br/>
</td>  <TD width="2%"></TD>
<td valign="top">Quote Number:</td>	<TD><input name="quotenumber"
width="15" type="text" value="6288326-2"></TD>
<td valign="top">Created Date: (system would automatically create it
for you)</td>
</tr>

<tr>
<td colspan="5" align="right">
Sales rep:
<select name="rep">

<option >John Doe

<option >Mary Johnson

</select>
</td>
</tr>

<tr>
<td></td> <TD width="2%"></TD>
<td>Revision: <br/>
</td>  <TD width="2%"></TD>
<td>Revision Date:</td>
</tr>
</table>

<table width="85%" align="center">
<tr>
<td>Reference: <input type="text" name="reference" width=15> </td>
<TD></TD>
<td>Contact Phone: </td> <TD width="2%"></TD>
<td></td> <TD width="2%"></TD>
</tr>

<tr>
<td>Company: <input type="text" name="company" width=15> </td> <TD></
TD>
<td>Contact Fax:</td> <TD width="2%"></TD>
<td></td> <TD width="2%"></TD>
</tr>

<tr>
<td>Contact:
<select name="contact">
<option value="5" >Barry, Nam
<option value="6" >LI, DON</select></td>
<TD width="2%"></TD>
<td>Contact Email:</td> <TD width="2%"></TD>
<td colspan=2 align="right">Pricing:
<select name="pricing" onchange="form.submit();">

<option selected value="MSRP
">MSRP

<option  value="PreferredDealer               ">Preferred
Dealer


</select>
</td>
</tr>

</table>

<br/>


<table border=1 width="85%" align="center">

<tr><td>Part number</td>  <td>Part name</td>	<td>Part description</td>
<td>XYZ</td>	<td>Delivery</td>	<td>Qty</td>	<td>Pricing</td>	<td>Total
($)</td>
</tr>

<tr>

		<td valign="top">
		<select name="partnumber" onchange="form.submit();">

			<option >1223322

			<option >123455

			<option selected>123456

			<option >13579

			<option >178939

			<option >223344

			<option >688939

			<option >776627273

			<option >7778899

			<option >7823439

			<option >788219

			<option >792932

			<option >7992

			<option >799939

			<option >892939

			<option >992392

		</select>
		</td>

		<td valign="top"><input type="text" id="partname" name="partname"
value="Cordless Phone" readonly></td>
		<td valign="top"><textarea id="partDescription"
name="partDescription" cols="30" rows="2" readonly>Handset, Black; add
back MSRP by $100 to 1195.  check OEM;
PMA rev B.</textarea></td>
		<td valign="top" nowrap=true> <input type="text" id="certificates"
name="certificates" value="ABC,EFG" readonly>
		</td>


		<td valign="top">
		<select name="delivery">
		<option value="15days">15 Days
		<option value="45days">45 Days
		</td>
<td valign="top"><input type="text" id="qty" name="qty" onBlur="if
(document.getElementById('total').value < 1)
{ document.getElementById('total').value=document.getElementById('qty').value
*
document.getElementById('priceLabel').value;document.getElementById('totalFinal').value=document.getElementById('total').value; }
else
{document.getElementById('total').value=0;document.getElementById('total').value=document.getElementById('qty').value
*
document.getElementById('priceLabel').value;document.getElementById('totalFinal').value=document.getElementById('total').value;}">
</td>
		<td valign="top"><input type="text" id="priceLabel"
name="priceLabel" value="1195"></td>
		<td valign="top"><input type="text" id="total" name="total"></td>


</tr>

<input type="hidden" id="temp" name="temp" value=0>



	<tr>










		<td valign="top">
		<select name="partnumber2" onchange="form.submit();">
			<option value="">

			<option >1223322

			<option >123455

			<option >123456

			<option >13579

			<option selected>178939

			<option >223344

			<option >688939

			<option >776627273

			<option >7778899

			<option >7823439

			<option >788219

			<option >792932

			<option >7992

			<option >799939

			<option >892939

			<option >992392

		</select>
		</td>
		<td valign="top"><input type="text" id="partname2" name="partname2"
value="Mat" readonly></td>
		<td><textarea id="partDescription2" name="partDescription2"
cols="30" rows="2" readonly>For comfort.</textarea></td>
		<td valign="top" nowrap=true><input type="text" id="certificates2"
name="certificates2"
value="                                                  " readonly>
		</td>

		<td valign="top">
		<select name="delivery2">
		<option value="15days">15 Days
		<option value="45days">45 Days
		</td>
<td valign="top">
<input type="text" id="qty2" name="qty2"
onBlur="if (document.getElementById('total2').value < 1)
{document.getElementById('total2').value=document.getElementById('qty2').value
*
parseFloat(document.getElementById('priceLabel2').value);document.getElementById('temp').value
= parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total2').value);document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} else
{document.getElementById('temp').value =
parseFloat(document.getElementById('temp').value) -
parseFloat(document.getElementById('total2').value);document.getElementById('total2').value=0;document.getElementById('total2').value=document.getElementById('qty2').value
*
parseFloat(document.getElementById('priceLabel2').value);document.getElementById('temp').value
= parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total2').value);document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} ">
</td>
		<td valign="top"><input type="text" id="priceLabel2"
name="priceLabel2" value="50"></td>
		<td valign="top">

		<input type="text" id="total2" name="total2">
		</td>


	</tr>


	<tr>


		<td valign="top">
		<select name="partnumber3" onchange="form.submit();">
			<option value="">

			<option >1223322

			<option >123455

			<option >123456

			<option >13579

			<option >178939

			<option >223344

			<option selected>688939

			<option >776627273

			<option >7778899

			<option >7823439

			<option >788219

			<option >792932

			<option >7992

			<option >799939

			<option >892939

			<option >992392

		</select>
		</td>
		<td valign="top"><input type="text" id="partname3" name="partname3"
value="Nuts & bolts" readonly></td>
		<td><textarea id="partDescription3" name="partDescription3"
cols="30" rows="2" readonly></textarea></td>
		<td valign="top" nowrap=true><input type="text" id="certificates3"
name="certificates3"
value="                                                  " readonly>
		</td>

		<td valign="top">
		<select name="delivery3">
		<option value="15days">15 Days
		<option value="45days">45 Days
		</td>
<td valign="top">
<input type="text" id="qty3" name="qty3"
onBlur="if (document.getElementById('total3').value < 1)
{document.getElementById('total3').value=document.getElementById('qty3').value
*
parseFloat(document.getElementById('priceLabel3').value);document.getElementById('temp').value
= parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total3').value);document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} else
{document.getElementById('total3').value=0;document.getElementById('total3').value=document.getElementById('qty3').value
*
parseFloat(document.getElementById('priceLabel3').value);document.getElementById('temp').value
= parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total3').value);document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} ">
</td>
		<td valign="top"><input type="text" id="priceLabel3"
name="priceLabel3" value="100"></td>
		<td valign="top">

		<input type="text" id="total3" name="total3">
		</td>


	</tr>

<tr>
	<td colspan="8" align="right">Discount: <input type="text"
id="discount" name="discount">
<input type="button" value="Deduct discount"
onclick="document.getElementById('totalFinal').value=parseFloat(document.getElementById('totalFinal').value)
- parseFloat(document.getElementById('discount').value);">
	<br/>
	(i.e. enter 50 for $50, 100 for $100, that is, leave out the $ sign)
	</td>
</tr>
<tr>
	<td colspan="8" align="right"><b>Total:</b> <input type="text"
id="totalFinal" name="totalFinal">
	<!-- input type="button" value="Calculate total" onclick="
document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);"-->
	</td>
</tr>
<tr>
	<td colspan="8" align="right">Expiration Date: <input type="text"
id="expireDate" name="expireDate"> <br/>
	(i.e. 8/21/2012 for Auguest 21, 2012)
	</td>
</tr>
<tr>
	<td colspan="8" align="right" valign="top">
	<table border=0>
	<tr>
	<td valign="top">
	Notes:
	</td>
	<td>
	<textarea name="notes" cols="60" rows="4"></textarea>
	</td>
	</td>
</tr>

</table>


<br/>

<table width="85%" align="center">
<tr>
	<td colspan="8" align="right"><input type="submit"
name="generateQuote" value="Generate Quotation"></td>
</tr>
</table>

</form>

</body>
</html>

[toc] | [prev] | [next] | [standalone]


#15573

Fromjustaguy <lichunshen84@gmail.com>
Date2012-08-26 08:48 -0700
Message-ID<c49c702d-947b-4151-b94e-bc68f6d32ef5@z8g2000yql.googlegroups.com>
In reply to#15570
On Aug 26, 9:26 am, justaguy <lichunshe...@gmail.com> wrote:
> On Aug 26, 5:27 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
> wrote:
>
>
>
>
>
>
>
>
>
> > Le 25/08/12 23:07, justaguy a crit :
>
> > > I must have moved the curse twice something on the quantity
> > > field
>
> > Don't understand too much ... Goole tells me that 'curse' is :
> > verb : to damn / swear / crown / abuse / inveigh / insult ...
> > name : malediction,  imprecation, misfortune, scourge, evil, calamity...
>
> > I think that with textfields in a form the onblur is appropriate
> > (somehow works as a validation, works fine when using keyboard to browse
> > along the form (accessibility), ie: tab key )
>
> > More, you could add tabindexes to quantity textfields to help visitor
>
> > --
> > St phane Moriaux avec/with iMac-intel
>
> Sorry, I meant "cursor".
>
> Back to what a poster mentioned earlier about posting the entire
> rendered HTML form here.  Here we go.  We still have a problem when a
> user goes back to change a quantity, then subtotal changes, total
> changes, and we don't know if the quantity is increased or decreased.
> Please copy/paste the following FORM to take a look.  Many thanks.
>
> <html>
> <head>
> <title>Quotation</title>
>
> </head>
>
> <body bgcolor="lightblue">
>
> <h1 align="center">Quotation</h1>
>
> <form action="ProcessQuote.cfm" method="post">
>
> <table width="85%" align="center">
> <tr>
> <td ROWSPAN=2>
> 123 Sunrise blvd, XYZ City, XX 12345 <br/>
> Phone: xxx-xxx-xxxx <br/>
> </td>  <TD width="2%"></TD>
> <td valign="top">Quote Number:</td>       <TD><input name="quotenumber"
> width="15" type="text" value="6288326-2"></TD>
> <td valign="top">Created Date: (system would automatically create it
> for you)</td>
> </tr>
>
> <tr>
> <td colspan="5" align="right">
> Sales rep:
> <select name="rep">
>
> <option >John Doe
>
> <option >Mary Johnson
>
> </select>
> </td>
> </tr>
>
> <tr>
> <td></td> <TD width="2%"></TD>
> <td>Revision: <br/>
> </td>  <TD width="2%"></TD>
> <td>Revision Date:</td>
> </tr>
> </table>
>
> <table width="85%" align="center">
> <tr>
> <td>Reference: <input type="text" name="reference" width=15> </td>
> <TD></TD>
> <td>Contact Phone: </td> <TD width="2%"></TD>
> <td></td> <TD width="2%"></TD>
> </tr>
>
> <tr>
> <td>Company: <input type="text" name="company" width=15> </td> <TD></
> TD>
> <td>Contact Fax:</td> <TD width="2%"></TD>
> <td></td> <TD width="2%"></TD>
> </tr>
>
> <tr>
> <td>Contact:
> <select name="contact">
> <option value="5" >Barry, Nam
> <option value="6" >LI, DON</select></td>
> <TD width="2%"></TD>
> <td>Contact Email:</td> <TD width="2%"></TD>
> <td colspan=2 align="right">Pricing:
> <select name="pricing" onchange="form.submit();">
>
> <option selected value="MSRP
> ">MSRP
>
> <option  value="PreferredDealer               ">Preferred
> Dealer
>
> </select>
> </td>
> </tr>
>
> </table>
>
> <br/>
>
> <table border=1 width="85%" align="center">
>
> <tr><td>Part number</td>  <td>Part name</td>      <td>Part description</td>
> <td>XYZ</td>        <td>Delivery</td>   <td>Qty</td>        <td>Pricing</td>    <td>Total
> ($)</td>
> </tr>
>
> <tr>
>
>                 <td valign="top">
>                 <select name="partnumber" onchange="form.submit();">
>
>                         <option >1223322
>
>                         <option >123455
>
>                         <option selected>123456
>
>                         <option >13579
>
>                         <option >178939
>
>                         <option >223344
>
>                         <option >688939
>
>                         <option >776627273
>
>                         <option >7778899
>
>                         <option >7823439
>
>                         <option >788219
>
>                         <option >792932
>
>                         <option >7992
>
>                         <option >799939
>
>                         <option >892939
>
>                         <option >992392
>
>                 </select>
>                 </td>
>
>                 <td valign="top"><input type="text" id="partname" name="partname"
> value="Cordless Phone" readonly></td>
>                 <td valign="top"><textarea id="partDescription"
> name="partDescription" cols="30" rows="2" readonly>Handset, Black; add
> back MSRP by $100 to 1195.  check OEM;
> PMA rev B.</textarea></td>
>                 <td valign="top" nowrap=true> <input type="text" id="certificates"
> name="certificates" value="ABC,EFG" readonly>
>                 </td>
>
>                 <td valign="top">
>                 <select name="delivery">
>                 <option value="15days">15 Days
>                 <option value="45days">45 Days
>                 </td>
> <td valign="top"><input type="text" id="qty" name="qty" onBlur="if
> (document.getElementById('total').value < 1)
> { document.getElementById('total').value=document.getElementById('qty').value
> *
> document.getElementById('priceLabel').value;document.getElementById('totalF inal').value=document.getElementById('total').value; }
> else
> {document.getElementById('total').value=0;document.getElementById('total'). value=document.getElementById('qty').value
> *
> document.getElementById('priceLabel').value;document.getElementById('totalF inal').value=document.getElementById('total').value;}">
> </td>
>                 <td valign="top"><input type="text" id="priceLabel"
> name="priceLabel" value="1195"></td>
>                 <td valign="top"><input type="text" id="total" name="total"></td>
>
> </tr>
>
> <input type="hidden" id="temp" name="temp" value=0>
>
>         <tr>
>
>                 <td valign="top">
>                 <select name="partnumber2" onchange="form.submit();">
>                         <option value="">
>
>                         <option >1223322
>
>                         <option >123455
>
>                         <option >123456
>
>                         <option >13579
>
>                         <option selected>178939
>
>                         <option >223344
>
>                         <option >688939
>
>                         <option >776627273
>
>                         <option >7778899
>
>                         <option >7823439
>
>                         <option >788219
>
>                         <option >792932
>
>                         <option >7992
>
>                         <option >799939
>
>                         <option >892939
>
>                         <option >992392
>
>                 </select>
>                 </td>
>                 <td valign="top"><input type="text" id="partname2" name="partname2"
> value="Mat" readonly></td>
>                 <td><textarea id="partDescription2" name="partDescription2"
> cols="30" rows="2" readonly>For comfort.</textarea></td>
>                 <td valign="top" nowrap=true><input type="text" id="certificates2"
> name="certificates2"
> value="                                                  " readonly>
>                 </td>
>
>                 <td valign="top">
>                 <select name="delivery2">
>                 <option value="15days">15 Days
>                 <option value="45days">45 Days
>                 </td>
> <td valign="top">
> <input type="text" id="qty2" name="qty2"
> onBlur="if (document.getElementById('total2').value < 1)
> {document.getElementById('total2').value=document.getElementById('qty2').va lue
> *
> parseFloat(document.getElementById('priceLabel2').value);document.getElemen tById('temp').value
> = parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total2').value);document.getElementById ('totalFinal').value=
> parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total').value);} else
> {document.getElementById('temp').value =
> parseFloat(document.getElementById('temp').value) -
> parseFloat(document.getElementById('total2').value);document.getElementById ('total2').value=0;document.getElementById('total2').value=document.getElem entById('qty2').value
> *
> parseFloat(document.getElementById('priceLabel2').value);document.getElemen tById('temp').value
> = parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total2').value);document.getElementById ('totalFinal').value=
> parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total').value);} ">
> </td>
>                 <td valign="top"><input type="text" id="priceLabel2"
> name="priceLabel2" value="50"></td>
>                 <td valign="top">
>
>                 <input type="text" id="total2" name="total2">
>                 </td>
>
>         </tr>
>
>         <tr>
>
>                 <td valign="top">
>                 <select name="partnumber3" onchange="form.submit();">
>                         <option value="">
>
>                         <option >1223322
>
>                         <option >123455
>
>                         <option >123456
>
>                         <option >13579
>
>                         <option >178939
>
>                         <option >223344
>
>                         <option selected>688939
>
>                         <option >776627273
>
>                         <option >7778899
>
>                         <option >7823439
>
>                         <option >788219
>
>                         <option >792932
>
>                         <option >7992
>
>                         <option >799939
>
>                         <option >892939
>
>                         <option >992392
>
>                 </select>
>                 </td>
>                 <td valign="top"><input type="text" id="partname3" name="partname3"
> value="Nuts & bolts" readonly></td>
>                 <td><textarea id="partDescription3" name="partDescription3"
> cols="30" rows="2" readonly></textarea></td>
>                 <td valign="top" nowrap=true><input type="text" id="certificates3"
> name="certificates3"
> value="                                                  " readonly>
>                 </td>
>
>                 <td valign="top">
>                 <select name="delivery3">
>                 <option value="15days">15 Days
>                 <option value="45days">45 Days
>                 </td>
> <td valign="top">
> <input type="text" id="qty3" name="qty3"
> onBlur="if (document.getElementById('total3').value < 1)
> {document.getElementById('total3').value=document.getElementById('qty3').va lue
> *
> parseFloat(document.getElementById('priceLabel3').value);document.getElemen tById('temp').value
> = parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total3').value);document.getElementById ('totalFinal').value=
> parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total').value);} else
> {document.getElementById('total3').value=0;document.getElementById('total3' ).value=document.getElementById('qty3').value
> *
> parseFloat(document.getElementById('priceLabel3').value);document.getElemen tById('temp').value
> = parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total3').value);document.getElementById ('totalFinal').value=
> parseFloat(document.getElementById('temp').value) +
> parseFloat(document.getElementById('total').value);} ">
> </td>
>                 <td valign="top"><input type="text" id="priceLabel3"
> name="priceLabel3" value="100"></td>
>                 <td valign="top">
>
>                 <input type="text" id="total3" name="total3">
>                 </td>
>
>         </tr>
>
> <tr>
>         <td colspan="8" align="right">Discount: <input type="text"
> id="discount" name="discount">
> <input type="button" value="Deduct discount"
> onclick="document.getElementById('totalFinal').value=parseFloat(document.ge tElementById('totalFinal').value)
> - parseFloat(document.getElementById('discount').value);">
>         <br/>
>         (i.e. enter 50 for $50, 100 for $100, that is, leave out the $ sign)
>         </td>
> </tr>
> <tr>
>         <td colspan="8" align="right"><b>Total:</b> <input type="text"
> id="totalFinal"...
>
> read more »


FYI, here's the latest version for the subtotal and total calculation
and recalculation.
Kind of messy but hopefully the logic is all right.
It works so far.  Note, #n# is a variable for a web scripting language
I'm using, and the following code is inside a loop.  Thanks.

<input type="text" id="qty#n#" name="qty#n#"
onBlur="if (document.getElementById('total#n#').value < 1)
{document.getElementById('total#n#').value=document.getElementById('qty#n#').value
*
parseFloat(document.getElementById('priceLabel#n#').value);document.getElementById('temp').value
= parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total#n#').value);document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} else
{document.getElementById('temp').value =
parseFloat(document.getElementById('temp').value) -
parseFloat(document.getElementById('total#n#').value);
document.getElementById('totalFinal').value=document.getElementById('totalFinal').value
- parseFloat(document.getElementById('total#n#').value);
document.getElementById('total#n#').value=0;
document.getElementById('total#n#').value=document.getElementById('qty#n#').value
* parseFloat(document.getElementById('priceLabel#n#').value);
document.getElementById('temp').value =
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total#n#').value);
document.getElementById('totalFinal').value=
parseFloat(document.getElementById('temp').value) +
parseFloat(document.getElementById('total').value);} ">

[toc] | [prev] | [next] | [standalone]


#15576

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-26 20:55 +0200
Message-ID<503a712f$0$6195$ba4acef3@reader.news.orange.fr>
In reply to#15570
Le 26/08/12 15:26, justaguy a écrit :
> On Aug 26, 5:27 am, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
>>
>> More, you could add tabindexes to quantity textfields to help visitor
>>
>> --
>> St phane Moriaux avec/with iMac-intel

Try to do not copy the signature in your response
Try to explain GoogleMail what is an accented letter.

> Sorry, I meant "cursor".

  ;-)

> Back to what a poster mentioned earlier about posting the entire
> rendered HTML form here.  Here we go.

the code or an url we can go to see.

> We still have a problem when a
> user goes back to change a quantity, then subtotal changes, total
> changes, and we don't know if the quantity is increased or decreased.

And ? What's the matter with that ?

> Please copy/paste the following FORM to take a look.  Many thanks.

a little bit laborious ...
But that seems to work.

About the question of in/de-crease you would have not to worry about as 
that is the complete (all the) form which will be send, analyzed by the 
php, and then the buyer receive back the correct command it did 
(calculated on server-side).


> <table width="85%" align="center">

arrrgghhh !

a table :-(
(to shape the presentation)
with its poor accessibility



<input type="text" id="qty" name="qty"
onBlur="if(document.getElementById('total').value < 1)
         // why this distinction ?
   {
   document.getElementById('total').value=
       this.value * document.getElementById('priceLabel').value;
   document.getElementById('totalFinal').value=
       document.getElementById('total').value;
   }
else
   {
   document.getElementById('total').value=0;  // hu ?
   document.getElementById('total').value=
       document.getElementById('qty').value *
       document.getElementById('priceLabel').value;
 
document.getElementById('totalFinal').value=document.getElementById('total').value;
   }">


idea :
======

<input type="text" id="qty" name="qty"
  onBlur="
  if(this.value<0) {
     alert('Quantity can\'t be negative !');
     this.value = 0;
     this.focus();
     this.select();
     }
  document.getElementById('total').value=
       this.value * document.getElementById('priceLabel').value;
document.getElementById('totalFinal').value=document.getElementById('total').value;
   }"
  onclick="this.select()">



-- 
Stéphane Moriaux avec/with iMac-intel

  * Unknown - détecté
  * Anglais
  * Français
  * Espagnol

  * Anglais
  * Français
  * Espagnol

  <javascript:void(0);>

[toc] | [prev] | [next] | [standalone]


#15579

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-08-26 20:50 +0000
Message-ID<k1e26f$r6g$1@dont-email.me>
In reply to#15570
On Sun, 26 Aug 2012 06:26:42 -0700, justaguy wrote:

> Back to what a poster mentioned earlier about posting the entire
> rendered HTML form here.  Here we go.  We still have a problem when a
> user goes back to change a quantity, then subtotal changes, total
> changes, and we don't know if the quantity is increased or decreased.
> Please copy/paste the following FORM to take a look.  Many thanks.

The html is broken in several ways:

1) You use <br/>, this is normally written <br /> (note space before "/") 
(see also 13)
2) You haven't closed your "input" elements. If you are using <br /> then 
your input elements also need to be terminated with " />" and not 
">" (see also 13)
3) You can't stick input elements at arbitrary points in a table element, 
even hidden input elements must be contained inside a <td></td> tag pair 
if you wish to use them inside a table.
4) You have unclosed options (see also 13).
5) You have unclosed selects.
6) You have unescaped character entities.
7) You have more <table> than </table> tags. Look at the nested table 
surrounding the "notes" textarea toward the bottom of the page.
8) You may be confusing the "size" attribute of the input element with a 
non standard attribute that you have called "width".
9) You have empty option elements.
10) "lightblue" is not a recognised color for the "bgcolor" attribute of 
the body element.
11) True is not a valid value for the "nowrap" attribute to the td 
element.
12) The document actually appears, when corrected, to be HTML 4.01 
transitional, so doesn't need closing "/ " of br or input elements, or of 
option elements. You should choose a markup for the page and stick to it, 
not use a mix of xhtml and html markup in a single page. Pick a doctype, 
declare it, stick to it, validate against it.
13) Your form is very wide - I assume you don't expect your customers to 
use tablets / mobile devices. You may wish to use size attributes on some 
of the columns in the table.
14) Consider css for styling.
15) In my opinion, It's a good habit to get into the practice of 
specifying attributes such as nowrap, readonly, selected in the form 
attr="attr", ie readonly="readonly", selected="selected", nowrap="nowrap", 
even if you are only using html 4.01.

16) Debugging javascript is easier if you write the functions out in a 
structured manner in a script section in the document head.
17) This also makes it possible for the functions to call each other, 
something that is not possible when attaching functions directly to 
actions.
18) You could then use a single function for updating the row totals 
every time any of the quantities is changed. You could also call the 
"totals" function from this single row function to apply the discount and 
update the totals.

See http://www.sined.co.uk/tmp/jag1.htm for an example of how it could be 
improved, and note that there may be many ways to improve on what I have 
done so far.

Note that I have reduced the code to the minimum required to show an 
example of how I would write the javascript to calculate the line and 
total prices, so it is a much simpler page than the one you posted.

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#15580

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2012-08-26 21:30 +0000
Message-ID<XnsA0BBEF27039BDeejj99@194.109.133.133>
In reply to#15579
Denis McMahon wrote on 26 aug 2012 in comp.lang.javascript:

> The html is broken in several ways:
> 
> 1) You use <br/>, this is normally written <br /> (note space before
> "/") (see also 13)
> 

Nonsense!

HTML is <br>

<br/> or <br /> is NOT html.

I don't know why you should think that somethinfg that is not wriitten as 
it "normally" is, makes it "broken".

But I reoeat:

In html, <br/> and <br /> should not be used, as only the fault-compliance 
of some browsers prevents the code not displaying as expected, or even not 
at all, by the programmer of such erroneous code.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#15583

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-08-26 22:29 +0000
Message-ID<k1e807$i6p$2@dont-email.me>
In reply to#15580
On Sun, 26 Aug 2012 21:30:34 +0000, Evertjan. wrote:

> Denis McMahon wrote on 26 aug 2012 in comp.lang.javascript:
> 
>> The html is broken in several ways:
>> 
>> 1) You use <br/>, this is normally written <br /> (note space before
>> "/") (see also 13)

> Nonsense!
> 
> HTML is <br>
>
> <br/> or <br /> is NOT html.

Yes, I know.

I'm not sure if the OP is serving this as xhtml or html, if he's serving 
xhtml it should be <br />.

If you read my comments through I pointed out further down that it seems 
to be html, and that if so, he doesn't need to close the br xml style, or 
the inputs or need </option> (although imo closing option, like li and p, 
is good practice).

Likewise, he doesn't have to declare values for readonly, selected or 
nowrap attributes, but again imo it's a good idea to do so.

If the OP's page is xhtml (suggested by <br/>) then it's broken by the 
unclosed option and input elements amongst others.

If the OP's page is html (suggested by the unclosed option and input 
elements, the lack of value assignments to selected and readonly 
attributes, and the use of the nowrap td attribute), then the <br/> is 
wrong.

Ultimately the markup the OP has offered us is not compliant with any 
defined schema that I'm aware of.

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#15581

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-26 23:32 +0200
Message-ID<503a9608$0$6185$ba4acef3@reader.news.orange.fr>
In reply to#15579
Le 26/08/12 22:50, Denis McMahon a écrit :
> On Sun, 26 Aug 2012 06:26:42 -0700, justaguy wrote:
>
>> Back to what a poster mentioned earlier about posting the entire
>> rendered HTML form here.  Here we go.  We still have a problem when a
>> user goes back to change a quantity, then subtotal changes, total
>> changes, and we don't know if the quantity is increased or decreased.
>> Please copy/paste the following FORM to take a look.  Many thanks.
>
> The html is broken in several ways:
>
> 1) You use <br/>, this is normally written <br /> (note space before "/")

"normaly" no space before but not "mandatory"

> 2) You haven't closed your "input" elements. If you are using <br /> then
> your input elements also need to be terminated with " />" and not ">"

certainly the br haven't to be closed ... no ?

> 3) You can't stick input elements at arbitrary points in a table element,
> even hidden input elements must be contained inside a <td></td> tag pair
> if you wish to use them inside a table.
> 4) You have unclosed options (see also 13).

facultatif (comme pour P, TR, TD, and so)

anyway ... we have no doctype ... we can drop the rope and choice the 
soup we want ... hop !


> 7) You have more <table> than </table> tags. Look at the nested table
> surrounding the "notes" textarea toward the bottom of the page.
> 8) You may be confusing the "size" attribute of the input element with a
> non standard attribute that you have called "width".

Rhalala ! C'est pas bien du tout !

> 10) "lightblue" is not a recognised color

and curiously any navigator display a kind of blue  ;-)

> 12) The document actually appears, when corrected, to be HTML 4.01
> transitional, so doesn't need closing "/ " of br or input elements, or of
> option elements. You should choose a markup for the page and stick to it,
> not use a mix of xhtml and html markup in a single page. Pick a doctype,
> declare it, stick to it, validate against it.

Voilà !

> 13) Your form is very wide - I assume you don't expect your customers to
> use tablets / mobile devices. You may wish to use size attributes on some
> of the columns in the table.

the table is 85% width

one of columns is 2% width ... with no effect (I think)

> See http://www.sined.co.uk/tmp/jag1.htm for an example of how it could be
> improved, and note that there may be many ways to improve on what I have
> done so far.

justaguy can also see "my" correction(*) of its file :
<http://cjoint.com/?BHAxltxiNiY>
<http://cjoint.com/12au/BHAxltxiNiY_boncomnd.htm>

(*) overall :
     - 1 function for the calcul
     - tabindex
     - except quantities, textfields in readonly
     - no more ids in the form
     - text-fields names in accordance with datas on server

-- 
Stéphane Moriaux avec/with iMac-intel

[toc] | [prev] | [next] | [standalone]


#15584

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-08-26 22:39 +0000
Message-ID<k1e8j4$i6p$3@dont-email.me>
In reply to#15581
On Sun, 26 Aug 2012 23:32:56 +0200, SAM wrote:

> anyway ... we have no doctype ... we can drop the rope and choice the
> soup we want ... hop !

If you think that not defining a doctype means you can do whatever you 
like with the markup, then you're mentally incompetent to write web pages.

>> See http://www.sined.co.uk/tmp/jag1.htm for an example of how it could
>> be improved, and note that there may be many ways to improve on what I
>> have done so far.
> 
> justaguy can also see "my" correction(*) of its file :
> <http://cjoint.com/?BHAxltxiNiY>
> <http://cjoint.com/12au/BHAxltxiNiY_boncomnd.htm>

He can see what's wrong with your "correction" here:

<http://validator.w3.org/unicorn/check?ucn_uri=cjoint.com%2F12au%
2FBHAxltxiNiY_boncomnd.htm&ucn_task=conformance#>

Rgds

Denis McMahon

[toc] | [prev] | [next] | [standalone]


#15587

FromSAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid>
Date2012-08-27 04:23 +0200
Message-ID<503ada1c$0$6216$ba4acef3@reader.news.orange.fr>
In reply to#15584
Le 27/08/12 00:39, Denis McMahon a écrit :
> On Sun, 26 Aug 2012 23:32:56 +0200, SAM wrote:
>
>> anyway ... we have no doctype ... we can drop the rope and choice the
>> soup we want ... hop !
>
> If you think that not defining a doctype means you can do whatever you
> like with the markup, then you're mentally incompetent to write web pages.

 From moment navigators can parse html.2 to html.5 correcting themselves 
what is too wrong, yes if you don't take care about what could babble 
w3c, any soup of html should be able to do the job.

>> justaguy can also see "my" correction(*) of its file :
>> <http://cjoint.com/?BHAxltxiNiY>
>> <http://cjoint.com/12au/BHAxltxiNiY_boncomnd.htm>
>
> He can see what's wrong with your "correction" here:

I'ven't been there as I know the file isn't conform
(that wasn't the correction's goal ...)

> <http://validator.w3.org/unicorn/check?ucn_uri=cjoint.com%2F12au%
> 2FBHAxltxiNiY_boncomnd.htm&ucn_task=conformance#>

Good new :
"Document est valide conformément à la recommandation CSS niveau 2.1!"
   ;-)

-- 
Stéphane Moriaux avec/with iMac-intel

[toc] | [prev] | [next] | [standalone]


#15589

FromMartin Leese <please@see.Web.for.e-mail.INVALID>
Date2012-08-27 11:09 -0600
Message-ID<k1g9kk$qvf$1@dont-email.me>
In reply to#15579
Denis McMahon wrote:
...
> 15) In my opinion, It's a good habit to get into the practice of 
> specifying attributes such as nowrap, readonly, selected in the form 
> attr="attr", ie readonly="readonly", selected="selected", nowrap="nowrap", 
> even if you are only using html 4.01.

Thanks for this.  The other advice was good
to, but this was one of which I hadn't
thought.  (It even validates at 4.01 Strict.)

-- 
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web