Forum Moderators: open

Message Too Old, No Replies

XHTML 1.1 Validation

What's up with the <noscript> tag?

         

pageoneresults

3:23 am on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I was just adding statistical code to a new site using javascript and for some reason cannot get the <noscript> tag to validate. Anyone have any suggestions?

<noscript><img border="0" width="1" height="1" alt="" src="/button5.asp?tagver=5&amp;si=000000&amp;fw=0&amp;js=No&amp;" /></noscript>

Line 88, column 36: there is no attribute "border" (explain...).
//--></script><noscript><img border="0" width="1" height="1" alt="" src="http://

Line 88, column 174: document type does not allow element "img" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag
...;si=000000&amp;fw=0&amp;js=No&amp;" /></noscript></div>

What do you do to replace the img border attribute? I know I can control my image borders through css, what effect does not having it in the html tag have? What replaced that attribute in XHTML 1.1?

Line 88, column 185: end tag for "noscript" which is not finished (explain...).
...amp;fw=0&amp;js=No&amp;" /></noscript></div>

If I remove the <noscript> I get validation. So, what's up with this <noscript> tag. What do I need to change so it passes XHMTL 1.1 validation?

papabaer

3:33 am on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The VALIDATOR is telling you that the image needs to be contained. Try wrapping it with a <p></p> element.

Modular CSS generally includes the img element with the inline text module and as such, requires imgaes to be contained, either in divs, paragraphs, etc.

I'm just guessing here.. but I suspect your code is only contained by the body element... You would get a similar error message if you placed plain text, "unwrapped," anywhere in the body...
- papabaer

BTW... <img border="0" /> is soooooo old skool! Not to mention "fattening" to the code.

CSS:

img {
border: 0;
}

.... keep it outta tha html.

pageoneresults

3:47 am on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hello papabaer. That <noscript> is contained inside a <div>. I tried wrapping it in its own <div> and another with <p> and I still get the same errors. I noticed now that I removed the border attribute that I get width errors when there is a width defined. I believe those errors are occuring because of the <noscript> issue.

universalis

1:59 pm on May 30, 2003 (gmt 0)

10+ Year Member



More specifically, You need to do something like:

<noscript>[b]<p>[/b]<img src="whatever.gif" alt="whatever">[b]</p>[/b]</noscript>

You can replace the <p> by a <div> or another block element.

You should also check out [w3.org...] (that is, section C4), which talks about using comments to hide your Javascript from older browsers.

g1smd

8:20 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> The VALIDATOR is telling you that the image needs to be contained. <<

That's my take on it as well. The image needs a wrapper, and that wrapper goes inside the noscript tags.

drbrain

9:23 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I also see what appears to be a ...//--></script>

In XHTML, this:

<script><!-- ... //--></script>

Is equivalent to:

<script></script>

When served with an XML mimetype.

If you're moving to XHTML, you need to be forwards compatible to when XML UAs (other than Gecko-based) are around.

pageoneresults

10:36 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



papabaer, universalis, and g1smd, I've gotten everything to validate now. I had my <p> tags in the wrong position when I first attempted. Hey, what can I say, I'm an old dog learning new tricks! Thanks for the replies.

g1smd, thanks for the info on the <script> tag. This is my first site in xhtml and I'm experimenting to see what I'm up against when I do make the transition with all sites. I've found that I've been able to validate XHTML 1.0 Strict and then I found the XHTML 1.1 DOCTYPE which I am now using. Which is more strict, 1.0 or 1.1? I couldn't find anything on a strict XHTML 1.1.

papabaer

11:14 pm on May 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



XHTML 1.1 is more stringent. It is the next stage towards fully modular XHTML. V.2.0 is still in it's infancy and due to its intended lack of backwards compatibility, it will some time before it becomes a concern.

pageoneresults

9:36 pm on May 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Okay, here is a new one and I cannot locate anything but a W3C list message concerning this issue. Apparently the img "name="Rollover Image Name" attribute is deprecated in XHTML 1.1. Here is the current code...

<div class="one"><a href="#" onmouseover="changeImages('imageone', '/images/one-over.gif'); return true;" onmouseout="changeImages('imageone', '/images/one.gif'); return true;"><img title="Image One" name="imageone" src="/images/one.gif" width="100" height="10" alt="Image One Tab" /></a></div>

The imageone is named and is part of a menu using javascript for rollovers. Without the image name attribute, the rollovers of course do not work.

Anyone familiar with this? If so, what did you do to fix the issue?

The error...

Line 40, column 254: there is no attribute "name" (explain...) img title="Image One" name="imageone" src="/images/one

P.S. The javascript is generated by ImageReady.

g1smd

10:12 pm on May 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Move the name attribute from the <img> tag to the <a> anchor instead?

(I might be wrong)

pageoneresults

1:16 am on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Now fully valid XHTML 1.1!

The name attribute has been the last thing on my list of XHTML 1.1 validation. I came across a couple of W3C List messages where this particular subject came up and there was really never any confirmed resolution that I could find.

Well, there I was researching XHMTL 1.1 further and sure enough, the answer to my problem...

The id attribute must be used instead of the name attribute. The name attribute for referencing elements is officially deprecated and may be removed in future XHTML specifications. Use the id attribute in its place.

Correct (id attribute used):

<img src="image.gif" id="imagename" alt="Image Name" />

Incorrect (deprecated name attribute used):

<img src="image.gif" name="imagename" alt="Image Name" />

I found a nice little list of Coding Standards using XHTML [macromedia.com] at the Macromedia site.

P.S. The problem had to do with using javascript rollovers. The javascript generated by Adobe ImageReady uses the name attribute.

g1smd

9:58 am on Jun 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Umm. OK I wasn't quite correct then, I took a stab at what seemed logical at the time, without looking in detail.

Don't forget that ids must be unique per document. That catches a lot of people out.