Script Error Checking

Discussion about any web related scripting languages like JavaScript, ASP, and PHP.

Script Error Checking

Postby paulp575 » Sun Mar 05, 2006 1: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,
paulp575
Rank II - Novice
Rank II - Novice
 
Posts: 42
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA

Postby Albert Wiersch » Mon Mar 06, 2006 11: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
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2433
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX

Re: Script Error Checking

Postby 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.
thenitbit
Rank 0 - Newcomer
Rank 0 - Newcomer
 
Posts: 6
Joined: Wed Oct 11, 2006 12:16 am


Return to Scripting Languages

Who is online

Users browsing this forum: No registered users and 2 guests