W3C HTML Validator

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

W3C HTML Validator

Post by anjanesh »

I was trying out W3C's Validator and returned more than 100 invalid tags.
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0>
does not seem to be acceptable.
Hows that when all browsers are accepting it ? Isnt this a valid tag ?
there is no attribute "LEFTMARGIN"
and same for rest 3.
How else can we define the margin positions of the document body ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

with CSS.. the way you are supposed to for, oh, the last 4 years. ;)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Im trying to have the page pass through the validator error free.
And what abt Javascript ? It doesnt seem to be parsing Javascript because this is what I did :

Code: Select all

<SCRIPT LANGUAGE=Javascript TYPE="text/javascript">
var ScreenWidth=screen.width,allowedWidth;
if (ScreenWidth>=1000) allowedWidth=1000; else allowedWidth=780;
document.write('<TABLE BORDER=0 WIDTH='+allowedWidth+' ALIGN=center>');
</SCRIPT>
<NOSCRIPT>
<TABLE BORDER=0 WIDTH=780 ALIGN=center>
</NOSCRIPT>
<TR><TD>etcetc</TD></TR>
gives a lot of errors :

"TABLE" not finished but containing element ended
</NOSCRIPT>
end tag for "TABLE" omitted, but its declaration does not permit this
</NOSCRIPT>
start tag was here
<TABLE BORDER=0 WIDTH=780 ALIGN=center>
document type does not allow element "TR" here
<TR><TD>etcetc</TD></TR>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

from what I remember, Javascript is ignored by html validators.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

When dynamically creating a tag based on JS, you won't validate correctly.
Because all it sees is:
<noscript>
<table blah blah>
</noscript>

which is invalid.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Im slowly getting this to work out.
1.

Code: Select all

<FORM>
<TABLE>
</TABLE>
</FORM>
2.

Code: Select all

<TABLE>
<FORM>
</FORM>
</TABLE>
1 seems to actual method (accepted) but its entering a line break so the table height becomes a bit more (I cant assign actual value)
2 on the other hand gives the size of the table - the same size when no form tags are included.
So how am I suppossed to get rid of that line break ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

CSS ::

margin:0;padding:0;
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

<FORM ID="id1" METHOD=POST ACTION="" STYLE="DISPLAY:inline">
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Where can I find a JS Validator like the one in W3C's HTML Validator ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

something wrong with your googling?
[google]javascript +validator[/google]
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Nothing like entering a url and validate like W3C's HTML and CSS Validator.
Google Results in mostly (html validator still give errors because of javascript code) or some javasript validator library in js file.
The only other one I've seen is struts.
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

ps : i would suggest you using mozilla and go download the devlopper tool, I mean, it's tha BOMB ..
beileive me..

EWhat you doing still reading GO download it ... 8)
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

some tips:

all tags and attribute-names should be lowercase
take away as much design attributes as you can, put it in an css file and include it
visit http://www.w3schools.com for CSS and HTML tips and examples
Post Reply