PDA

View Full Version : Validation error for script language='javascript', but I'm using type=text



cfructose
Aug 16th, 2007, 05:26 PM
validator.w3.org is giving me this error message:


Line 18, Column 17: there is no attribute "LANGUAGE".
<script language='javascript'><!--

Now, I'm well aware that 'language' is deprecated, and I'm pretty sure that
<script type="text/javascript" src="scriptname.js"></script> is correct...

The mystery is that
<script language='javascript'><!--[/ doesn't occur anywhere in my code.

As for the 'line 18' that the validator tells me, it sure as hell ain't on line 18.

My doctype:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Any thoughts?

Thanks a lot.

liorean
Aug 16th, 2007, 05:28 PM
It might be useful if you linked the site for us so we could check for ourselfves...

cfructose
Aug 16th, 2007, 05:32 PM
It's not live yet; still under development. htaccess password 'n' all that.

Perhaps the 'language' line is in the code, but I simply can't find it. (I've tried, believe me!).

I think I would be most helped by understanding what to make of the validator's "Line 18, Column 29"... Does that mean line 18 on the notepad file that opens when I say 'view source'? What of 'column'?

liorean
Aug 16th, 2007, 06:28 PM
It's not live yet; still under development. htaccess password 'n' all that.Ah. Seems like I should expand the point "If the code is on an intranet, put it somewhere where we can access it." to "If the code is on an intranet or otherwise not openly accessible, put in somewhere where we can access it" in How to make it easy for us to help. If you want help, be prepared to show the code you want help with.
Perhaps the 'language' line is in the code, but I simply can't find it. (I've tried, believe me!).

I think I would be most helped by understanding what to make of the validator's "Line 18, Column 29"... Does that mean line 18 on the notepad file that opens when I say 'view source'? What of 'column'?The validator's error is always for the generated code - in other words, it's after any server side processing has been done, including processing some hosts do even on static files. (E.g. Geocities, Tripod, Lycos and other hosts that inserts ads)



So, it's the "view source" file it's talking about. Also, Notepad counts only CRLF as a newline, but the validator treats all of CRLF, LF and CR as newlines, so changing text editor to something better should help. (I recommend SciTE, that's what I personally use on Windows systems)

cfructose
Aug 16th, 2007, 06:48 PM
Thanks.

Forgive me for not making the code available. I wasn't trying to be difficult. It simply seems to me that if I search for "script language" after viewing source, and I find nothing (which is indeed what I find - no hits), then that line of code cxlearly isn't there!

I presumed what you said about carraige returns etc in notepad (I'll download SciTE later!) But the w3c validator says line 18, so it can't be too far off from line 18 in either direction.

My code certainly says
script type="text/javascript" , and I use no other javascript on the site except for calling to that single javascript text file.

The ostensible culprit deprecated 'language' line doesn't exist - hence the futility of showing the code - I'm merely wondering what could be causing this error alert.

Is this not something that anyone's ever seen before? :-)

GJay
Aug 16th, 2007, 07:03 PM
under the 'More Options' bit of the W3C validator, there is a 'show source' option. If you tick that, and validate, it will show you the source with relevant line numbers.

If your site isn't publicly accessible, you aren't giving the URL to the validator are you?

cfructose
Aug 16th, 2007, 07:19 PM
GJay - thanks.
I used the 'more options show source' thang, and found the culprit immediately.

In case anyone's interested in my stupidity, this is what happened:

The reason 'view source' wasn't showing the code is that it was code being outputted by php only if a certain session variable was not set.
That particular var had already been set in my browser window, although for the validator, it wasn't, hence:


script language='javascript'>

wasn't being echoed for me, but was being echoed for w3c!

...And there I was thinking I was so clever for having finally understood the difference between server-side and client-side...! :-) Surely, anything echoed by php happens before it's converted to html and read by the validator! Well, right as that is, I hadn't allowed for:


if (!isset($_SESSION['xf']))

Anyway, thanks for your time, and sorry for being a dunce.

PS If I enter my htaccess username and password at the validator, does that jeopardise something I'm not aware of? (I don't have anything incriminating or terribly important security-wise on there, I merely wanted to stop anyone arriving at a half-finished site, but your warning has made me wonder...)

GJay
Aug 16th, 2007, 10:44 PM
does it ask you for the user/pass? I wasn't aware it did, that's actually quite sensible of them- I was thinking it would just fail to connect (and that you'd have to paste in the HTML source), I've never used it with a protected page.

cfructose
Aug 16th, 2007, 10:51 PM
Yeah, it asks you. Bravo to them!

This validator, however,

http://www.htmlhelp.com/tools/validator/

simply fails.

OK, I can sleep easy now. You worried me for a second!
:-)