Hi,
At oyster web one of the tasks we carry out on a site is making sure it is w3 compliant. Brining flash onto the page has always been a problem with the W3.org html valuator, for example the code produced by Macromedia Dreamwaver brings up the 7 errors:
1. Line 78, column 19: there is no attribute "SRC"
<embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
2. Line 78, column 38: there is no attribute "QUALITY"
<embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
3. Line 78, column 57: there is no attribute "PLUGINSPAGE"
...flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashpl
4. Line 78, column 108: there is no attribute "TYPE"
...cromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1
5. Line 78, column 146: there is no attribute "WIDTH"
...application/x-shockwave-flash" width="100" height="100"></embed>
6. Line 78, column 159: there is no attribute "HEIGHT"
...-shockwave-flash" width="100" height="100"></embed>
7. Line 78, column 164: element "EMBED" undefined
...kwave-flash" width="100" height="100"></embed>
- 1. Line 78, column 19: there is no attribute "SRC"
- <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
- 2. Line 78, column 38: there is no attribute "QUALITY"
- <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.
- 3. Line 78, column 57: there is no attribute "PLUGINSPAGE"
- ...flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashpl
- 4. Line 78, column 108: there is no attribute "TYPE"
- ...cromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1
- 5. Line 78, column 146: there is no attribute "WIDTH"
- ...application/x-shockwave-flash" width="100" height="100"></embed>
- 6. Line 78, column 159: there is no attribute "HEIGHT"
- ...-shockwave-flash" width="100" height="100"></embed>
- 7. Line 78, column 164: element "EMBED" undefined
- ...kwave-flash" width="100" height="100"></embed>
Searching the web, we could not find a solution. I the past week I have been tackling a piece of JavaScript with a lot of code, when it dawned on me. CDATA.
So here’s the code to do it:
Javascript In head, or better still, an external js file linked i the head (“oyster-flash” being the variable name to indicate the flash file):
function flash(oyster-flash) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="175">');
document.write('<param name="movie" value="flashdirectory/' + oyster-flash + '.swf');
document.write('<embed src=" flashdirectory/' + oyster-flash + '.swf " quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="175"></embed>');
document.write('</object>');
}
- function flash(oyster-flash) {
- document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="175">');
- document.write('<param name="movie" value="flashdirectory/' + oyster-flash + '.swf');
- document.write('<embed src=" flashdirectory/' + oyster-flash + '.swf " quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="550" height="175"></embed>');
- document.write('</object>');
- }
On the page (“flash” being the name of the flash file) :
<script type='text/javascript'>
//<![CDATA[
flash('flash');
//]]></script>
- <script type='text/javascript'>
- //<![CDATA[
- flash('flash');
- //]]></script>
The script above gives no errors on the w3 Validator, shortens the on-the-page code and has no effect to the playing of the flash file.
Hope this helps
Kai