473,511 Members | 17,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Arithmetic decrement --x; does not w3c-validate

Hi -
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
>>>>>>
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
<<<<<

Aside from writing tdiff = tdiff -1; how should I code this?

See www.rurale.ca or specifically
www.plonque.com/rurale/bowl2006.php

Thanx....
Tony King www.tonyking.tk

Nov 6 '06 #1
5 2103
On 2006-11-06, aq****@gmail.com <aq****@gmail.comwrote:
Hi -
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
>>>>>>>
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
<<<<<

Aside from writing tdiff = tdiff -1; how should I code this?
tdiff -= 1;
Nov 6 '06 #2
aq****@gmail.com wrote:
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
On its own, it isn't.
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
The only reason why that should occur is if you're using XHTML and
including comments (the markup variety) within the script element. Do
neither.
Aside from writing tdiff = tdiff -1; how should I code this?
Serving XHTML as text/html is pointless. See previous discussions in
this group for reasons.

The practice of "hiding" scripts is obsolete, doubly so in XHTML where
it literally means to ignore the script: to treat it as a comment.
See www.rurale.ca or specifically
www.plonque.com/rurale/bowl2006.php
As I suspected...

Mike
Nov 6 '06 #3

Ben C wrote:
On 2006-11-06, aq****@gmail.com <aq****@gmail.comwrote:
Hi -
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
>>>>>>
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
<<<<<

Aside from writing tdiff = tdiff -1; how should I code this?

tdiff -= 1;
Geez! An answer WITHIN MINUTES! And it works!
Last time I posted on GG (a coupla years ago) it took 24 hours for it
to get posted, never mind the answer-time!
I've used =and <= but have nevr come across -= before.
Must brush up my javascript knowledge!

Thanx, Ben!

Nov 6 '06 #4
Hello,

aq****@gmail.com wrote:
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
>>>>>>>
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
<<<<<

Aside from writing tdiff = tdiff -1; how should I code this?

See www.rurale.ca or specifically
www.plonque.com/rurale/bowl2006.php
Generally: don't use comments in SCRIPT elements (same for STYLE) like
<script ..><!-- .. --></script>
This is for user-agents that do not know the special semantics of SCRIPT and
STYLE. These elements are around for quite a while, so I doupt there's any
user-agent left in the wild, which requires these comments.

And you are using XHTML which makes these comments even more lethal: in
XHTML these comments *are* real comments (in HTML only those deprecated
user-agents would parse it as comments). So if the document is parsed as
XML (parsing XHTML as HTML is just a temporary work-around) as XHTML is
supposed to be and you fixed the parse error, the SCRIPT element would
contain nothing at all.

You have the following options:

- Stick with HTML. In this case you can savely omit the comments.

- If you have very good reasons to use XHTML, use <![CDATA[ .. ]]instead
of <!-- --(or nothing at all, if your script does not contain any '<'s
or '&'s).

- Move the script to an extenal file and use
<script type="text/javascript" src="path/to/script.js"></script>
HTH

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/
Nov 6 '06 #5
On 2006-11-06, aq****@gmail.com <aq****@gmail.comwrote:
>
Ben C wrote:
>On 2006-11-06, aq****@gmail.com <aq****@gmail.comwrote:
Hi -
I have a page with a javascript date calculation in it, and the W3C
validator tells me that the statement
--tdiff;
is invalid.
>>>
Error Line 38 column 3: invalid comment declaration: found name start
character outside comment but inside comment declaration.
--tdiff;
<<<<<

Aside from writing tdiff = tdiff -1; how should I code this?

tdiff -= 1;

Geez! An answer WITHIN MINUTES! And it works!
Last time I posted on GG (a coupla years ago) it took 24 hours for it
to get posted, never mind the answer-time!
I've used =and <= but have nevr come across -= before.
Must brush up my javascript knowledge!
Actually I replied a bit too quickly. As someone else pointed out, --tdiff is
legal EcmaScript anyway, so you may have had something else wrong.
Nov 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2634
by: Henk Verhoeven | last post by:
(Reply on this newsgroup to an email - reply by email did not work) Wolfman wrote: > > Hi, > I found your Email in the php Newsgroup. > I was looking for some way to resize some graphiks on my...
53
5656
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
1
908
by: al | last post by:
Greetings, I have this javascript code in ASP.NET code behind: Dim str1 as string ="test" Private Sub Page_Load(byval sender as system.Obeject, byval e as system.eventargs)handles...
5
13270
by: Stuart | last post by:
Hi all, Iv'e got a page that has a mass amount of input fields, all of which require a decimal figure. To make it easier when it comes to inputting data, I'm trying to setup + and - links that...
3
5292
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
6
1219
by: Patient Guy | last post by:
The question in the subject seems plain to me. I wonder if EMCAscript/Javascript developers should even bother adding IE7 even to the clients in which to test script/code. The same goes for any...
1
7566
by: DaniltonW | last post by:
I am trying to create a code for add a page to the favorite but "AddFavorite" not appears in the following function: javascript: window. external. AddFavorite? In javascript:window.external. does...
4
4368
by: Bernd Gaertner | last post by:
Dear experts, according to my interpretation of the Standard, loop 1 in the following program is legal, while loop 2 is not (see explanation below). This looks a bit counterintuitive, though; do...
22
2851
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created...
0
7144
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.