473,473 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need a example on how to validating xhtml with javascripts

jon
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">
//<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
//]]>
</script>
Here is a snippet of my code:
<script language="javascript" type="text/javascript">
<!--
function printdate() {
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
}
var ZanimObjects = new Array();

function ZanimSlide(AnimName, BackName, Velocity, StartXOffset,
StartYOffset)
{
var bo;
var p;
var t;
}
// -->
</script>
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
//-->
</script>
<script type="text/javascript">
<!--
function P7_StyleLoader(tS) { //v1.2 by PVII
var tH='',tDoc='',tA='<LIN'+'K REL="stylesheet" HREF=',tB=' }
P7_StyleLoader('w3csheet.css');
//-->
</script>
</head>
<body onload="InitAnim()">
I would appreciate it if someone could help me out with get this to validate
using xhtml.
thank you
Jul 24 '05 #1
3 1804


jon wrote:

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">
//<![CDATA[
for (var i = 0; i < 3; i++) {
//
}
//]]>
</script>


That is the (well one) right approach so you have the solution, simply
apply that to the snippets you have below and instead of wrapping script
blocks in
<!--

//-->
as you have below you now use
//<![CDATA[

//]]>
But note that the whole approach with a JavaScript comment wrapping a
CDATA section is only necessary if you want to author XHTML and send it
as text/html to HTML browsers like IE. In that case it is very doubtful
that you need XHTML as HTML 4.01 is as expressive as XHTML 1.0 so you
might want to reconsider and send HTML 4 as text/html to the browsers.
See also
<http://www.hixie.ch/advocacy/xhtml>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 24 '05 #2
I recommend storing all your javascript in a separate file.

Like :

<script src="validate.js"></script>

This also has the side effect of encouraging you to
reuse your javascript functions.

Jul 24 '05 #3
On 13 Jun 2005 11:38:07 -0700, gi*******************@yahoo.com wrote:
I recommend storing all your javascript in a separate file.

Like :

<script src="validate.js"></script>

This also has the side effect of encouraging you to
reuse your javascript functions.


You also want to put in type="text/javascript" so it'll validate.

BB
--
www.kruse.co.uk/ se*@kruse.demon.co.uk
seo that watches the river flow...
--
Jul 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kerberos | last post by:
When I deliver a page as text/html, the javascripts work, but if delivered as application/xhtml+xml, the javascripts don't work: function OpenBrWindow(theURL,winName,features, myWidth, myHeight,...
30
by: Toni Mcintyre | last post by:
i'm having 2 problems with the http://validator.w3.org 1. if i have: <meta http-equiv="Content-Script-Type" content="text/javascript"> then why do i need <script type=text/javascript>...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
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...
2
by: and | last post by:
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...
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
by: PapaRandy | last post by:
Hello, I am trying to validate the following .py webpage as HTML (through W3C). I put: ----------------------------------------------------------------------------- print "Content-type:...
6
by: Rolf Welskes | last post by:
Hello, if I have for example: <table style="width: 100%; height: 100%;" border="1"> <tr> <td style="width: 100px">k </td> <td style="width: 100px">k </td> </tr>
2
by: SONIQ | last post by:
Using javascripts to validate this form. Basic operation, when a user clicks the submit order button, the javascript code must validate everything entered by the user. Please help finnish this...
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
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.