Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript and Markup Validation Service

Status
Not open for further replies.

JamesGMills

Programmer
Aug 15, 2005
157
GB
Hi,

I am having a few problems and i dont know how to fix it to be honest. I am trying to move from HTML to XHTML and i am using the tool to help me.

The site is at and when i validate the code its all problems with javascript.

ERROR E.G.
for (var e = 0; e < form.elements.length; e++) {

This is from:

...
function PostForm(form,Address,ArticleID) {
for (var e = 0; e < form.elements.length; e++) {
var el = form.elements[e];
...

If you run the site through the validation tool you will see there are also some more problems that i am having but i dont know what to do about them? Is there something i am doing wrong?

Thanks


------------------------
 
They are not errors, the page valiodates they are warnings!!

however to be 100% you need to 1. you should place this around your scripts...
Code:
<script type="text/javascript">
[b]// <![CDATA[[/b]

script stuff

[b]  // ]]>[/b]
</script>

and escape any charachrers & = &amp; > = &gt; etc..

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
try putting your script in comment tags, something like

<script>
<!--
your javascript goes here
// -->
</script>

this will make it work in older browsers

I would actually recommend that you put your script in an external js file then provide a link to it. For example create a file called javascript.js with all your code in it, then in the head section of your html

<script src="javascript.js" type="text/javascript" />
 
Thanks for that... we do use an external javascript file now but i think its a asp include at the moment. I will take a look.

Thanks for you input people... i will get back onto this on monday.

------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top