Re: Proper coding? (JS newbie)
- From: Dr J R Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 6 Sep 2007 17:21:20 +0100
In microsoft.public.scripting.jscript message <46dfaa68$0$24580$ecde5a14
@news.coretel.net>, Thu, 6 Sep 2007 03:20:30, Paul E. Schoen
<pstech@xxxxxxxxx> posted:
My new version of this page will be posted at:
www.smart.net/~pstech/DogLicenseJS.htm
I'll be updating it as I learn more.
You should put the date visibly on the page, in standard form (i.e.
YYYY-MM-DD) so that anyone can see immediately how new it is.
W3's free "HTML Tidy for Windows released on 19 April 2007" said :
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 3 column 75 - Warning: discarding unexpected </meta>
line 131 column 12 - Warning: <input> attribute "+totalfee" lacks value
line 137 column 1 - Warning: replacing </p> by <br>
line 135 column 1 - Warning: missing </h3> before <p>
line 142 column 1 - Warning: replacing </p> by <br>
line 140 column 1 - Warning: missing </h3> before <p>
line 5 column 1 - Warning: <script> inserting "type" attribute
line 120 column 1 - Warning: <form> lacks "action" attribute
line 131 column 12 - Warning: <input> attribute "type" has invalid value
"number
"
line 136 column 1 - Warning: <input> attribute "type" has invalid value
"number"
line 134 column 1 - Warning: trimming empty <p>
line 139 column 1 - Warning: trimming empty <p>
Info: Document content looks like HTML 4.01 Transitional
Info: No system identifier in emitted doctype
13 warnings, 0 errors were found!
To learn more about HTML Tidy see http://tidy.sourceforge.net
Please send bug reports to html-tidy@xxxxxx
HTML and CSS specifications are available from http://www.w3.org/
Lobby your company to join W3C, see http://www.w3.org/Consortium
http://validator.w3.org/ said "Failed validation, 16 Errors"
Those are checking HTML, not script.
AdjustArray[0] = new Array(1.0, 1.1, 1.2, 1.5, 1.0);
can be
AdjustArray[0] = [1.0, 1.1, 1.2, 1.5, 1.0];
and the whole of AdjustArray can be given likewise.
parseInt(Form1.Weight.value) can probably be +Form1.Weight.value
Rather than using iter <= 4 you could read the actual length of the
array; one fewer thing to change if another button is added.
If one selects Multiple Bites then Minor Nip, it responds with Fee
increased by 110.000 001%. You mean 10%, not 110%; and I reduced the
offence so the fee should decrease. Re 100.000 001, see FAQ 4.6 and
links.
A 99-lb dog, minor nip, shows $54.67000000000001 - FAQ again.
A 99-lb dog and an 099-lb dog cost differently.
Your new Array( 3, 5 ) is not a 2-dimensional array; Javascript does not
have them even though A[4,8] is meaningful.
I find the alerts tiresome; the text could easily be written to a
"latest change" readonly input control.
Your hbh dbh obh are used as Booleans but given integer values;
javascript has Booleans.
AdjustArray is indexed only by literal numeric constants; names could be
used (*some* resemblance to an enumerated type).
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
.
- Follow-Ups:
- Re: Proper coding? (JS newbie)
- From: Paul E. Schoen
- Re: Proper coding? (JS newbie)
- References:
- Proper coding? (JS newbie)
- From: Paul E. Schoen
- Re: Proper coding? (JS newbie)
- From: Randy Webb
- Re: Proper coding? (JS newbie)
- From: Paul E. Schoen
- Re: Proper coding? (JS newbie)
- From: \(O\)enone
- Re: Proper coding? (JS newbie)
- From: Paul E. Schoen
- Proper coding? (JS newbie)
- Prev by Date: Re: onChage event
- Next by Date: offestTop et scrollTop always zero
- Previous by thread: Re: Proper coding? (JS newbie)
- Next by thread: Re: Proper coding? (JS newbie)
- Index(es):