/    Sign up×
Community /Pin to ProfileBookmark

HTML validation problems

Hi !

I have tried to validate a page with w3 html validator and recieved the following errors :

required attribute “TYPE” not specified
<script language=”JavaScript”>

document type does not allow element “DIV” here; missing one of “APPLET”, “OBJECT”, “MAP”, “IFRAME”, “BUTTON” start-tag
onClick=”fKarta(‘3’)”>&nbsp;</div> – and 3 more of the same kind.

I have attached a whole report, so you can see it in details. Can anyone tell me where am I making a mistacke (and how to fix it)

to post a comment
HTML

19 Comments(s)

Copy linkTweet thisAlerts:
@NikolaVeberauthorMay 03.2003 — here is the attachment

[upl-file uuid=0b10708b-ca0e-43c1-b589-1b9fa6d11123 size=13kB]check.zip[/upl-file]
Copy linkTweet thisAlerts:
@khalidali63May 03.2003 — You should have posted a link to your page instead of errors page,

typical mistakes,which all IE developers had been used to.

  • 1. make all elements to have their relative closing tag, e.g <br/>


  • 2. script element does not have langauge attribute any more replace this with

    type="text/javascript" attribute


  • 3. Make sure all of the attributes are enclosed withing qoutes.


  • 4. to be even better practice,always use small case for all ehtml elements and attributes.


  • Make these changes and you will have a waaaaaaaaaay shorter list of errors
    Copy linkTweet thisAlerts:
    @toicontienMay 03.2003 — Concerning the errors on lines 539 - 542, with not allowing DIVs to be placed there: You have those DIVs wrapped in the anchor tag <a>. To get the page to validate, you'll probably have to find an alternative way to accomplish the affect you want. As a general rule, you should not place block elements inside inline elements.

    The <a> tag is an inline element and the DIV is a block element. You could try to use SPANs instead of DIVs. You can position both tags any way you want. The downside is the NS 4.x might not recognize a positioned SPAN, though I haven't tried it yet.

    According to HTML 4.01 specs http://www.w3.org/TR/html401/struct/text.html#edef-BR

    the <br> tag has no end tag, nor does it have a relative end tag (<br/>). What khalidali63 was referencing to was actually XHTML 1.0 Strict. Using the <br> tag just as I have for HTML 4.01 is just fine. It's sounds kind of strange, but in case you REALLY want to know, here's how to specify the break tag in the three main flavors of HTML:

    HTML 4.01

    <br>

    XHTML 1.0 Transitional

    <br /> - The space between the tag keyword and the forward slash is so NS 4.x recognizes the / as an errant attribute and ignores it.

    XHMTL 1.0 Strict

    <br/> - Most browsers will handle this fine, accept for the aforementioned NS 4.x bug. It thinks the tag keyword is br/, which is not a tag that Netscape Navigator recognizes. Use this DTD if you are 100% sure that NS4.x users won't view the site, or you have some other workaround for the forward slash problem.
    Copy linkTweet thisAlerts:
    @khalidali63May 03.2003 — Pardon me for not being as elaborate as you were,but isn't the future only xhtml?

    if not then I take my words back..:-)

    but if it is,thenw hats the harm of advising people to follow such standards that they will not have to worry about their pages being failed in next couple of yrs?

    ?
    Copy linkTweet thisAlerts:
    @NikolaVeberauthorMay 03.2003 — thanx !

    its ok now. Sorry about the url, I forgot to post it

    www.frigofrutti.co.sr

    So, you think that xhtml is the next step in web publishing ? Whaich are the main advantages ?
    Copy linkTweet thisAlerts:
    @khalidali63May 03.2003 — Advatanges?I'd say its more about making webpages more standard compliant.

    XHTML will be a xml document ,which will follow the exact standards of well formed documents as xml itself does.This will nehance the controlling of a webpage using DOM.if you really want,go to

    http://w3c.org

    you can read all about html4.01 and xhtml and why they had a need for a well formed html document.

    Honestly I do not disagree that some things are still allowed in html4.01 transitionl which menas it still allowes some recently deprecated elements or attributes,but my philosophy is to follow the as strict standard as possible so that when the time comes I am laughing..:-)
    Copy linkTweet thisAlerts:
    @toicontienMay 05.2003 — Actually khalidali63, I couldn't agree with you more. I've been redesigning a web site using xhtml, which you can view the mock-ups here: http://www.cm-life.com/pages/newdesign/html/

    And I love CSS layouts. I'm also anal retentive so having a well formed document is a healthy way for me to feed that ?

    In any event, good reading on xhtml and css can be found at http://www.alistapart.com/

    It's got more than just code examples and delves in to the philosphy behind many of the web standards.

    And besides. All new browsers support xhtml and css layouts. So why not use the standards, right? Just another tool to use to make our jobs easier and increase the usability of our product. Sounds like a good deal to me.
    Copy linkTweet thisAlerts:
    @nkaisareMay 05.2003 — TOI already pointed out reasons for the errors. Adding to it,

    <script language="JavaScript">

    should be

    <script type="text/javascript"> or <script type="text/javascript" language="JavaScript">

    I also suggest you put the javascript into a separate file. This will help reduce download time for poor souls like myself who can only afford 56.6 connection, and turn off images and javascript while browsing. Having said that, you should check how your site looks under such conditions (does your site make sense to a text browser?).

    XHMTL 1.0 Strict

    <br/>[/quote]

    I don't think so. My page validated as XHTML 1.0 Strict with the space before />.

    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.prism.gatech.edu%2F%7Egte207x%2Fexperiment%2Fpage1.html&charset=%28detect+automatically%29&doctype=%28detect+automatically%29&ss=1&verbose=1
    Copy linkTweet thisAlerts:
    @Jerry_FiskMay 06.2003 — Hi folks,

    I am in the process of developing a large web site using XHTML and CSS. (Actually redesigning and expanding)

    I like to think I am at an intermediate level but am beginning to think I should demote myself to novice beginner.

    Anyway, I check my HTML using "HTML Tidy for windows (vers 1st May 2002[Terry's build] built on May 4 2002."

    When I used it to check a TOC page it resulted in the 3 warnings below.

    "Improperly escaped URI reference"

  • 1. <p><a class="two" href="mailto:[email protected]?subject=Product Info" title="Email link for info"> e-mail me</a> and I will provide you with the information…</p>


  • 2. <p><a class="two" href="mailto:[email protected]?subject=Which Products Should I Use?"> Which Products Should I Use? </a></p>


  • 3. <p><a class="two" href="mailto:[email protected]?subject= Product Brochures"> Product Brochures</a></p>


  • (Note: The following "mailto" did not show up as a warning but is the same as numbers #1, #2 and #3 above.)

    <p><a class="two" href="mailto:[email protected]?subject=Warranty">

    Product Warranty</a></p>


    And then when I ran the page through the W3C to validate the page I expected to get the same type of messages but got this message instead:

    I used this declaration:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    This page is not Valid XHTML 1.0 Transitional!

    Below are the results of attempting to parse this document with an SGML parser.

  • 1. Line 1, column 120: DTD did not contain element declaration for document type name

    ...R/xhtml1/DTD/xhtml1-transitional.dtd">

    ^

  • 2. Line 2, column 42: document type does not allow element "html" here (explain...).

    <html xmlns="http://www.w3.org/1999/xhtml">

    ^

  • 3. Line 36, column 122: there is no attribute "width" (explain...).

    ...mp;page=store" target="_BLANK" width="90%" title="Visit the Amsoil On Line St

    ^

  • 4. Line 450, column 24: no document element

    </html>


  • I don't understand why these notations were made, in Tidy or the validater.

    I do know that in #3 the target tag has been depreciated but it shouldn't have shown up in a transitional document.

    Should it??

    Then again, the validater says it's not a XHTML 1.0 document. It must have something to do with the DOC TYPE declaration.

    I know I should be happy I only received 4 notations but, they are 4 that I cannot correct if I don't know why. Likewise with the mailto warnings from Tidy.

    Thanks
    Copy linkTweet thisAlerts:
    @khalidali63May 06.2003 — can you post a link to this url you are trying to validate using w3c html validator?
    Copy linkTweet thisAlerts:
    @Jerry_FiskMay 06.2003 — Khalid,

    Sure I just posted it here:

    Note the links won't work because it is the only file posted for this project.

    http://alphasynthetics.com/TOC_allproducts.html

    But now I have another problem. The following table houses my heading but the Alpha Synthetics Logo doesn't appear altouogh the Amsoil 30year logo does. They are both in the images folder. Now I am really confused. It's problably something simple I can't see. I may have to demote myself to idiot. (o:

    <table cellspacing="0" summary="text" align="center">

    <tr align="center">

    <td valign="top">


    <h2><img src="../images/30yearlogo_130px.gif" height="144" width="130" alt="Amsoil 30 Year Logo" align="left" />

    <img src="../images/alphahead.gif" width="428" height="131" alt="Alpha Synthetics Logo" /><br />Your Source For Quality Synthetic Lubricants</h2>

    </td>

    </tr>

    </table>
    Copy linkTweet thisAlerts:
    @nkaisareMay 06.2003 — 1.

    <!DOCTYPE [b]html[/b] PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    2.

    mailto:[email protected]?subject=Product[b]%20[/b]Info

  • 3. replace width="90%" with style="width: 90%"?

    It looks like the error is in <a> tag (targetting new window). Its better to avoid use of target="_blank". Use javascript instead:
    &lt;a href="this.html" onclick="window.open('this.html'); return false;"&gt;Opens
    in new window if javascript is ON else opens in same window&lt;/a&gt;

    <PERSONAL RANT> Why do you want to do that. If I need to open a new window, I'll do so myself. Dont clutter my desktop.

    </PERSONAL RANT>
  • Copy linkTweet thisAlerts:
    @khalidali63May 06.2003 — Jerry,I did took the liberty of making "several" changes in your code to make it compliant..:-)

    try validating the link below

    http://68.145.35.86/temp/TOC_allproducts.html
    Copy linkTweet thisAlerts:
    @Jerry_FiskMay 06.2003 — Khalid,

    Thanks for trying but it can't read it. I copied the source code and put in my text/stylesheet editor (TopStyle Pro ver 3.1)then ran the w3c validater. The results are at this address.

    http://alphasynthetics.com/w3cvalsheet.html

    What changes did you make?

    Cheers,
    Copy linkTweet thisAlerts:
    @khalidali63May 06.2003 — seems like your problem is in the file saving...do this.

    copy the code from the link,

    open a blank notepad document.paste it in there and save it as html document.

    I have run it and I can send you the results as well

    here is the w3c results page..:-)

    http://validator.w3.org/check?uri=http%3A%2F%2F68.145.35.86%2Ftemp%2FTOC_allproducts.html
    Copy linkTweet thisAlerts:
    @nkaisareMay 06.2003 — In my opinion, you should not abuse blockquote for layout. Instead you can use

    <h3>Product Catagories</h3>

    <ul style="list-style: none">

    <li>Synthetic Diesel Motor Oils</li>

    <li>Synthetic Gasoline Motor Oils</li>

    <li>Synthetic Gear Lubes and Chaincase Lubricant</li>

    ...

    </ul>

    Also, you have

    <p><strong>...</strong></p>

    What does marking entire page as <strong> mean? Instead, you can simply use p {font-weight: bold}. This is visually same, but semantically correct (hence better for search engines and non-visual browsers).

    The format of the page is header+2column+footer. This can be very easily achieved using CSS without any browser specific hack.

    Personal note to Khalid:

    On one hand, you suggest people to use <br /> instead of <br>. On the other hand, you make no note of improper use of blockquote for layout. I don't see much logic into this.

    ** Mean no malice. Just an observation **
    Copy linkTweet thisAlerts:
    @khalidali63May 06.2003 — just an honest overlook..was more concern making his code validated for him.

    Thans for pointing it out though

    ?
    Copy linkTweet thisAlerts:
    @Jerry_FiskMay 06.2003 — Thanks Khalid, nkaisare,

    nkaisare,

    I didn't know I was abusing blockquote (poor thing) (o:

    I will do it your way and see what happens.

    BTW, I do have a css rule that will take care of the <strong> tag. I'm trying to stay away from using the font tag in the body. I'm beginning to like css2.

    Khalid,

    As we say here in Texas, "muchos gracias" (Much thanks) I now have to compare both files to see what you did to make it fly so I can get the other umpten flles to fly.

    Cheers,
    Copy linkTweet thisAlerts:
    @khalidali63May 06.2003 — de nada amigo...

    ?
    ×

    Success!

    Help @NikolaVeber spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.2,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,
    )...