473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 5049


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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Justin Sane | last post by:
I'm always sending back and forth my pages to the W3C XHTML validator (I can't stand error!) I also develop using application/xhtml+xml header, but still, there are errors that are not XML errors...
11
by: Woolly Mittens | last post by:
I tried validating my gallery page using your validator. http://validator.w3.org/check?uri=http%3A%2F%2Fwww.woollymittens.nl%2Fcontent%2Fgallery%2Findex.asp To my surprise it informed me that...
41
by: CMAR | last post by:
What are the pluses and minuses of constructing and validating between XHTML Transitional vs. HTLM 4.01 Strict Thanks, CMA
3
by: Ney André de Mello Zunino | last post by:
Hello. I decided to start experimenting with XHTML 2.0, having never messed with any of its previous versions, except for a quick look at XHTML 1.0 when it came out. When I tried to validate the...
0
by: Lachlan Hunt | last post by:
Hi everyone, I've just discovered a registry hack to get around the Windows XP SP2 security bug that prevents files being uploaded as text/html, and thus unable to validate local html files using...
3
by: jon | last post by:
Hello, I am new to trying to validate this xhtml so I will try to explain as best I can. Ok, I currently have a draft html file which I am trying to validate to a xhtml. Right now I have a couple...
2
by: Joris Janssens | last post by:
I'm trying to write a program for validating XHTML 1.1-documents against the XHTML 1.1 DTD (which is actually the same as validating an XML-file) but I always get a "(404) Not found" error. This...
2
harshmaul
by: harshmaul | last post by:
Hi all, I am writing a form for end users to input XHTML that will be displayed on the site. I know that is way too much trust for my users but what can you say you gotta do what the boss...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.