Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi Guy's & Gal's,
I'm stumpted !!! and I'm trying to learn.
Tried searching and came up zipped.
I am trying to validate my web site using XHTML. All frames except one are validated.
The one frame that will not validate uses the following ( embeded ) code:
<script
type="text/javascript">
if (navigator.userAgent.indexOf('MSIE') > -1)
{
document.write('<bgsound src="celine.mp3" loop="3" />');
} else {
document.write('<embed src= "celine.mp3" width="180" height="16" autoplay="true" loop="true" align="right" controller="true" />');
}
</script>
I am using <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">The web site works fine except for (Top.html) "validation".
http://www.claypenetration.com
lucky1

Do some basic troubleshooting to find the cause.
First off, leave in the document.write statements, but have them write nothing to the page. If the page still does not validate, then you know it is the javascript. If the pages do validate, then you know it has something to do with the HTML code that the document.write statements are writing to the page.
Then go from there. For example, if you find that it is the HTML code in the JS that is causing the problem, try just one of them, then the other. You might find that only one of the statements is causing the error.
Michael J

Why are you using a different entity to play sounds for Internet Explorer? BGSOUND is not part of any HTML declaration at all but is a typical microsoft-html-element.
The EMBED-element isnt part of valid HTML either. To play sounds you can use the OBJECT-element with the required attribute "type" (in mime-format). The OBJECT-element is the only element that is part of XHTML.
In your case, try the following line to replace the whole javascript-code:<OBJECT type="audio/mpeg" data="celine.mp3" width="180" height="16" align="right">
You browser doesnt support playing mp3-files.
</OBJECT>Only this is valid HTML, although I can imagine it is not what you want. But in your quest to make sites that can be read and understand fully by ALL browsers, writing valid code is the first step...

Thanks Michael J and Khalid,
The problem must be in the code !!
Khalid, when I use the <object type></object> as you suggested, it works in Opera and Firefox but not in IE ????
I guess I will leave it alone and not worry over validating one page.
Thanks to you both as well as all the others that contribute to this forum.
I can't tell you how much I and perhaps many others that read and apply the information garnered from this form.
Thanks again. . . . . .
lucky1

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |