473,737 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript" 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 CrossFadeDurati on = 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.sty le.filter="blen dTrans(duration =2)";
document.images .PictureBox.sty le.filter="blen dTrans(duration =CrossFadeDurat ion)";
document.images .PictureBox.fil ters.blendTrans .Apply();}
document.images .PictureBox.src = preLoad[jss].src;
if (document.getEl ementById)
document.getEle mentById("Capti onBox").innerHT ML= Caption[jss];
if (document.all) document.images .PictureBox.fil ters.blendTrans .Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('run SlideShow()', 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 5105


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*******@yaho o.de> wrote in message
news:41******** *************** @newsread2.arco r-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
2043
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 but that the W3C reports as errors because some elements are not supposed to be where they are at times. Is there a way to have the exact equivalent of the W3C XHTML validator to use locally, maybe a PHP debug script, I don't know...? That...
11
6046
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 <tfoot> wasn't valid XHTML 1.1 strict, while it is in the document definition: http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_tablemodule My <thead> tag apparently was valid, while my <tfoot> wasn't. I would appreciate it if...
41
1248
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
4098
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 test document I was working on, I noticed that the W3C's validator does not yet deal with XHTML 2.0 files. Does anybody know of a validator that does? Also, does anybody have any information on when W3C will be updating their validator in order...
0
1691
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 the W3C validator. I posted the hack on my blog . It's now possible to validate both .html (text/html) and .xhtml (application/xhtml+xml) files using IE. This only affects file uploads from a HTML form, it does not make IE accept pages served...
3
1822
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 of javascripts with a body onload " " tag. What I would like is to embedded scripts using xml cdata sections eg. <script type="text/javascript"> //<!]> </script> Here is a snippet of my code: <script language="javascript"...
2
2641
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 is the program itself : ******************************************************************** using System; using System.Xml; using System.Xml.Schema;
2
1175
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 wants. Anyway ... How do i validate the input, i "intelisense browsed" and i worked out how to validate xml, but i can't get it to change the schema it uses. This is the standard xml parser.
10
2077
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 type="text/css" href="proj_default.css" title="ss_default"> <title>Testing html</title> </head>
0
8966
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9257
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6749
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.