470,815 Members | 1,320 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

validating xhtml with javascripts in page

and
Hi

I have been validating all day most things are cool but I cant get by this
problem.

One I have listed the script (JAVASCRIPT ) in all the right placesnot a prob
but the validator insists on going through t findind < (less than) in the
code.
why is it going through the script the scripts been tagged correctly?
Also in the body where the link to the script is there is a table givng
image size (height width)
validator says this is a no pass
doesnt much like the table
I cant put a style on the table and address that through CSS cos it messes
with the script
Tried putting the sript outside the page in a js file didnt work either.

Any ideas

Its a nice little image slideshow very slow n subtle i'd ike to leave it in
but transitional validations a must (UNI)
Below are the results of attempting to parse this document with an SGML
parser.

1.. Line 84, column 18: character "<" is the first character of a
delimiter but occurred as data

for (iss = 1; iss < pss+1; iss++){

If you wish to include the "<" character in your output, you should escape
it as "&lt;". Another possibility is that you forgot to close quotes in a
previous tag.

?

2.. Line 106, column 14: an attribute value specification must be an
attribute value literal unless SHORTTAG YES is specified

<body onload= runSlideShow() >

?

3.. Line 106, column 26: an attribute value must be a literal unless it
contains only name characters

<body onload= runSlideShow() >

You have used a character that is not considered a "name character" in an
attribute value. Which characters are considered "name characters" varies
between the different document types, but a good rule of thumb is that
unless the value contains only lower or upper case letters in the range a-z
you must put quotation marks around the value. In fact, unless you have
extreme file size requirements it is a very very good idea to always put
quote marks around your attribute values. It is never wrong to do so, and
very often it is absolutely necessary.

?

4.. Line 211, column 289: required attribute "alt" not specified

...width="71" height="89" align="right" /></p>

The attribute given above is required for an element that you've used, but
you have omitted it. For instance, in most HTML and XHTML document types the
"type" attribute is required on the "script" element and the "alt" attribute
is required for the "img" element.

Typical values for type are type="text/css" for <style> and
type="text/javascript" for <script>.

?

5.. Line 216, column 70: required attribute "alt" not specified

..."nicar/nicarmap.JPG" width="414" height="329" /> </p>

?

6.. Line 233, column 46: an attribute value specification must be an
attribute value literal unless SHORTTAG YES is specified

<td><div align="center"><img src="" width=105 height=138 name=PictureBox>

?

7.. Line 233, column 57: an attribute value specification must be an
attribute value literal unless SHORTTAG YES is specified

<td><div align="center"><img src="" width=105 height=138 name=PictureBox>

?

8.. Line 233, column 67: an attribute value specification must be an
attribute value literal unless SHORTTAG YES is specified

...n="center"><img src="" width=105 height=138 name=PictureBox>

?

9.. Line 233, column 77: required attribute "alt" not specified

..."" width=105 height=138 name=PictureBox>

?

10.. Line 233, column 78: end tag for "img" omitted, but OMITTAG NO was
specified

... width=105 height=138 name=PictureBox>

You may have neglected to close a tag, or perhaps you meant to
"self-close" a tag; that is, ending it with "/>" instead of ">".

?

11.. Line 233, column 28: start tag was here

<td><div align="center"><img src="" width=105 height=138 name=PictureBox>

12.. Line 242, column 27: an attribute value specification must be an
attribute value literal unless SHORTTAG YES is specified

13..
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

14..
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<td class="style10" id=CaptionBox><div align="center"><span
class="style24">

HERES THE SCRIPT
<script language="JavaScript" type="text/JavaScript">
// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.

// ==============================
// Set the following variables...
// ==============================

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var Picture = new Array(); // don't change this
var Caption = new Array(); // don't change this

// Specify the image files...
// To add more images, just continue
// the pattern, adding to the array below.
// To use fewer images, remove lines
// starting at the end of the Picture array.
// Caution: The number of Pictures *must*
// equal the number of Captions!

Picture[1] = 'nicar_images/1.jpg';
Picture[2] = 'nicar_images/2.jpg';
Picture[3] = 'nicar_images/3.jpg';
Picture[4] = 'nicar_images/4.jpg';
Picture[5] = 'nicar_images/5.jpg';
Picture[6] = 'nicar_images/6.jpg';
Picture[7] = 'nicar_images/7.jpg';
Picture[8] = 'nicar_images/8.jpg';
Picture[9] = 'nicar_images/9.jpg';
Picture[10] = 'nicar_images/10.jpg';

// Specify the Captions...
// To add more captions, just continue
// the pattern, adding to the array below.
// To use fewer captions, remove lines
// starting at the end of the Caption array.
// Caution: The number of Captions *must*
// equal the number of Pictures!

Caption[1] = "Asese";
Caption[2] = "Catepint";
Caption[3] = "Chinandega";
Caption[4] = "Managua";
Caption[5] = "Mombacho";
Caption[6] = "Momotombo";
Caption[7] = "Nicaragua";
Caption[8] = "Conception";
Caption[9] = "Hammocks";
Caption[10] = "Cathederal";

// =====================================
// Do not edit anything below this line!
// =====================================

var tss;
var iss;
var jss = 1;
var pss = Picture.length-1;

var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}

function runSlideShow(){
if (document.all){
document.images.PictureBox.style.filter="blendTran s(duration=2)";
document.images.PictureBox.style.filter="blendTran s(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Appl y();}
document.images.PictureBox.src = preLoad[jss].src;
if (document.getElementById)
document.getElementById("CaptionBox").innerHTML= Caption[jss];
if (document.all) document.images.PictureBox.filters.blendTrans.Play ();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

</script>

</head>
<body onload= runSlideShow() >

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~

HERES THE BODY REFERNCE TO THE SCRIPT
<table>
<tr><!--
The next table cell holds the images.
Set cell and image width and height the same.
The img src must have name=PictureBox in its
tag. Usually the first image in the Picture
array in the script is used here.
//-->
<td><div align="center"><img src="" width=105 height=138
name=PictureBox>
</div></td></tr>
<tr><!--
The next table cell holds the captions.
This table cell must have id=CaptionBox and
class=Caption in its tag. The default caption
shows whilst loading in all browsers; NS4
will show only the default caption, throughout.
//-->
<td class="style10" id=CaptionBox><div align="center"><span
class="style24">Welcome</span> </div></td>
</tr>
</table>
Jul 23 '05 #1
2 4888


and wrote:

1.. Line 84, column 18: character "<" is the first character of a
delimiter but occurred as data

for (iss = 1; iss < pss+1; iss++){

If you wish to include the "<" character in your output, you should escape
it as "&lt;". Another possibility is that you forgot to close quotes in a
previous tag.


If you want to use script in XHTML served as text/html you are making
your life hard for yourself, consider using HTML 4.01 instead and it is
easy.
If you insist on using XHTML then the first move should be to use
external scripts as
<script type="text/javascript" src="file.js"></script>
works equally well in HTML, XHTML, whether you served it as text/html or
text/xml or application/xhtml+xml.
If you want to use embedded scripts then learn about XML CDATA sections e.g.
<script type="text/javascript">
<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
]]>
</script>
as the proper way to escape such stuff in XML. But then you probably
want to serve it as text/html to an HTML browser and to play safe on
that you need a way to hide the CDATA syntax, using JavaScript comments
is a way
<script type="text/javascript">
//<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
//]]>
</script>

But as said, if you want to serve text/html the simply use HTML 4.01, no
need to trouble yourself with XML rules and the additional trouble of
writing XML that can be parsed by a HTML parser.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
and
Okay thats all way over my head
Not that experienced
It has to be XHTML validated transitional for Uni
Just treally liked the subtleness of that particular picture changer

I did try taking the script and making it an external JS the only thing that
happened was that i was presented witha blankpage and I could'nt get round
that I opened up other JS files and had'nt been doing anything wrong(Can
internal scripts just be removed wholesale and put externally ??)

But as you see the problem is not only with the ">" being recognised in the
script as an unfinished TAG

but the body part of the statement that calls on Caption boxes and Picture
Boxes i.e. name =Picture Box
XHTML knows f no such object.

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread2.arcor-online.net...


and wrote:

1.. Line 84, column 18: character "<" is the first character of a
delimiter but occurred as data

for (iss = 1; iss < pss+1; iss++){

If you wish to include the "<" character in your output, you should
escape it as "&lt;". Another possibility is that you forgot to close
quotes in a previous tag.


If you want to use script in XHTML served as text/html you are making your
life hard for yourself, consider using HTML 4.01 instead and it is easy.
If you insist on using XHTML then the first move should be to use external
scripts as
<script type="text/javascript" src="file.js"></script>
works equally well in HTML, XHTML, whether you served it as text/html or
text/xml or application/xhtml+xml.
If you want to use embedded scripts then learn about XML CDATA sections
e.g.
<script type="text/javascript">
<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
]]>
</script>
as the proper way to escape such stuff in XML. But then you probably want
to serve it as text/html to an HTML browser and to play safe on that you
need a way to hide the CDATA syntax, using JavaScript comments is a way
<script type="text/javascript">
//<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
//]]>
</script>

But as said, if you want to serve text/html the simply use HTML 4.01, no
need to trouble yourself with XML rules and the additional trouble of
writing XML that can be parsed by a HTML parser.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Justin Sane | last post: by
11 posts views Thread by Woolly Mittens | last post: by
3 posts views Thread by Ney André de Mello Zunino | last post: by
2 posts views Thread by Joris Janssens | last post: by
10 posts views Thread by Robert Huff | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.