xhtml strict javascript problem trying to use "id" in plane of "name" attribute

xhtml strict javascript problem trying to use "id" in plane of "name" attribute

am 28.08.2007 02:07:27 von meyazoo

I have tried to resolve this in several ways that I have found on the
internet, but none seems to work. Here is the shortened code which is
a website displaying a webcam. The .jpg is overwritten with new image
from the camera. This code works, but does not pass W3C XHTML
STRICT.

1) How can I keep this working, and change the attribute to "id" so is
passes STRICT?
2) While I'm asking questions, what purpose does the "//" in the // [CDATA[ line perform? When I read the spec (http://www.w3.org/TR/
xhtml1/) it only says to use
MY CODE ***************************************
***************************************************

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



Camsite




CAM_3



height="240" name="image3" alt="Image loading ..." id="image3" />


Re: xhtml strict javascript problem trying to use "id" in plane of "name" attrib

am 28.08.2007 02:54:30 von Martin Jay

On Tue, 28 Aug 2007 00:07:27 -0000, meyazoo@gmail.com wrote:

>I have tried to resolve this in several ways that I have found on the
>internet, but none seems to work. Here is the shortened code which is
>a website displaying a webcam. The .jpg is overwritten with new image
>from the camera. This code works, but does not pass W3C XHTML
>STRICT.
>
>1) How can I keep this working, and change the attribute to "id" so is
>passes STRICT?

The 'id' is fine. The validator doesn't like 'name.'

>2) While I'm asking questions, what purpose does the "//" in the // >[CDATA[ line perform? When I read the spec (http://www.w3.org/TR/
>xhtml1/) it only says to use
There's an explanation here: .

You may find that 'HTML 4.01 strict' is more suited to your needs.
--
Martin Jay

Re: xhtml strict javascript problem trying to use "id" in plane of "name" attrib

am 28.08.2007 05:18:49 von cwdjrxyz

On Aug 27, 7:07 pm, meya...@gmail.com wrote:
> I have tried to resolve this in several ways that I have found on the
> internet, but none seems to work. Here is the shortened code which is
> a website displaying a webcam. The .jpg is overwritten with new image
> from the camera. This code works, but does not pass W3C XHTML
> STRICT.
>
> 1) How can I keep this working, and change the attribute to "id" so is
> passes STRICT?
> 2) While I'm asking questions, what purpose does the "//" in the // > [CDATA[ line perform? When I read the spec (http://www.w3.org/TR/
> xhtml1/) it only says to use >
> MY CODE ***************************************
> ***************************************************
>
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
>
>
> Camsite
>
>
>
>
>

CAM_3


>

> > height="240" name="image3" alt="Image loading ..." id="image3" />
>

>
>

CDATA is an xml thing. Xhtml is a hybrid that handles both html and
xml. Javascript often contains some things that are not allowed in
xml. Thus if you serve the xhtml properly as application/xhtml+xml,
the page is parsed as xml and you get an error message rather than
viewing the page if the script contains things that are forbidden in
xml. Enclosing the script in the open and close CDATA tags tells the
xhtml parser not to check the enclosed section for xml errors, since
it is something other than xhtml. You can avoid all of this be using
an external script in the manner usual for html. Notice the // before
the opening and closing CDATA tags. If you serve the xhtml page
improperly as html, these // are javascript comment tags which mean
that the CData tags are not seen. However if the xhtml page is
properly served as application/xhtml+xml, the browser sees right
through the // to find the CDATA tags and understands what such xml
tags mean. This is fortunate, because most xhtml pages are mis-served
as html rather than application/xhtml+xml. If you have the bare CDATA
tags without // on an xhtml page so mis-served the script will not
work, since a parser for html does not know what they mean.
If you serve an xhtml correctly as application/xhtml+xml, the page can
not be viewed by any IE browser, and will have to resort to some
tricks to get a html page to IE browsers. Most other modern browsers
understand properly served xhtml. I would guess that well over 90% of
pages written in xhtml are not being served as application/xhtml+xml.
In that case the xhtml code serves no useful purpose over html, and
the page would be better written in html 4.01 strict.