• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

XHTML Strict 1.0 document fails due to some javacript

I have a whole website which is passing the XHTML Strict 1.0 validation, however I have one page which is failing due to a section of javascript on the page.

It fails on the following;

<script type="text/javascript">
// Detect if flash installed, if so, show flash, if not, show HTML
var so = new SWFObject("flash/home.swf", "mainFlash", "780", "490",8,'#96a3b1');
so.write("flashcontent");

// Check if flash is available, and if so then unhide the div with content
function getFlashObj(movie){
if (window.document[movie]) {
document.getElementById('flash_text').style.display = 'block';
return window.document[movie];                        
}
if (navigator.appName.indexOf("Microsoft Internet")==-1) {
if (document.embeds && document.embeds[movie]) {
return document.embeds[movie];
}
} else {
return document.getElementById(movie);
}
}
getFlashObj('mainFlash');
</script>

The point it seems to fail at is anywhere where it has && 

Can anyone help with this.
0
AlivewithTechnology
Asked:
AlivewithTechnology
1 Solution
 
hernst42Commented:
For XHTML use CDATA-tags like:

<script language="JavaScript" type="text/javascript">
/* <![CDATA[ */
 
// Check if flash is available, and if so then unhide the div with content
function getFlashObj(movie){
if (window.document[movie]) {
document.getElementById('flash_text').style.display = 'block';
return window.document[movie];                        
}
if (navigator.appName.indexOf("Microsoft Internet")==-1) {
if (document.embeds && document.embeds[movie]) {
return document.embeds[movie];
}
} else {
return document.getElementById(movie);
}
}
getFlashObj('mainFlash');
/* ]]> */
</script>

Open in new window

0
 
AlivewithTechnologyAuthor Commented:
Absolutely spot on, thank you
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now