Script Error Checking

Discussion about any web related scripting languages like JavaScript, ASP, and PHP.
Post Reply
paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Script Error Checking

Post by paulp575 » Sun Mar 05, 2006 12:52 pm

I keep getting an error about not using '<!--' and '-->' in scripts (to keep older browsers from viewing the contents of the script rather than running the script).

Problem is, on some scripts, if I insert that code, the script no longer runs!!!
Is there a way to avoid this - I don't write the scripts, so changing the scripts is above my head!

Thanks,

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3347
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch » Mon Mar 06, 2006 10:16 am

Hello,

In XHTML, you shouldn't surround scripts and styles (in the "style" element) with comment markers because they could (and should) be ignored by the browser/agent, but you should be able to in HTML, so it depends on the DOCTYPE.

If you want to simply not use comment markers at all, then you can always disable that validator message by right-clicking on it when it apepars in the Results Window and choosing Options for this Message->Disable Message.

I should probably remove that message by default in v8.0 because most people today don't use such old browsers where not using comment markers would be an issue.
Image
Albert Wiersch

thenitbit
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 6
Joined: Wed Oct 11, 2006 12:16 am

Re: Script Error Checking

Post by thenitbit » Wed Oct 11, 2006 10:39 am

paulp575 wrote:I keep getting an error about not using '<!--' and '-->' in scripts (to keep older browsers from viewing the contents of the script rather than running the script).

Problem is, on some scripts, if I insert that code, the script no longer runs!!!
Is there a way to avoid this - I don't write the scripts, so changing the scripts is above my head!

Thanks,
Hi Paul,

I got the same problem earlier, until I realised that comment markers can change a script into a comment when coded on the same line.
Make sure you insert a line break after '<!--' and one before '-->' and everything works fine!

Regards,
Alfred Vorsselman, the Netherlands.

Post Reply