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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validating bgsound

Status
Not open for further replies.

SlowFlight

Programmer
Jan 2, 2003
33
US
I have a web site which contains background music. The music plays all right in all my browsers. But when I try to validate the pages, the only thing that comes up as not valid is the code for the background music.
This is my code:

<bgsound src=&quot;sounds/NA2earth.mid&quot; loop=&quot;infinite&quot; />

These are the errors I get:

Line 14, column 13: there is no attribute &quot;src&quot;

Line 14, column 40: there is no attribute &quot;loop&quot;

Line 14, column 52: element &quot;bgsound&quot; undefined

This is the explanation to the first two errors:

“there is no attribute ‘FOO’ for this element (in this HTML version)”
You have used an attribute with an element that is defined not to have that attribute. This is most commonly caused by using vendor-specific attributes without setting the document type appropriately.

This is the explanation to the third error:

“element ‘FOO’ undefined”
You've used an unknown tag (represented here by ‘FOO’). Make sure the DTD indicated by your DOCTYPE actually includes this element.


And this is how my DOCTYPE is set:

<!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;
<html xmlns=&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;>

Any suggestions as to how I can get this to validate?

Sailor Skip
 
<bgsound> is an IE extension, not an official (X)HTML tag. That's why the validator doesn't like it, though browsers are more forgiving. To validate, you'll need to use the <object> tag instead.

Personally I've never seen fit to irritate my users by inflicting my choice of background music on them, so I can't help you with how to set the tag up.

-- Chris Hunt
 
I think that embed might be valid, but it won't play on all browsers (not even all common browsers). Check the w3c and see what they suggest instead. In all honesty, if that is all that didn't validate, I'd either leave the page (if it HAS o have sound - ICK! I like the CD I'm playing not to defiled with a bad quality MIDI or WAV) or cut the sound out completly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top