Netizens often ask how to make Flash tags embedded in web pages comply with web standards. There is currently no perfect solution. In this article, we write Flash embedded tags into js files and pass parameters through variables to avoid tags that do not meet standards.
Please note that this is just a workaround. Changing the soup without changing the medicine does not ultimately solve the existing problems. Passing the verification is just an appearance. Whether this idea is advisable, please consider it yourself in actual operation.
First create a JS file flash.js. Write the following code:
function swf(file,w,h) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7 ,0,19,0 " width="'+w+'" height="'+h+'"> ');
document.write('<param name="movie" value="' + file + '">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');
document.write('<embed src="' + file + '" quality="high" pluginspage=" http://www .macromedia.com/go/getflashplayer " type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
document.write('</object> ');
}
The above js script defines a function swf and sets three variables, which are: flile file link, w width, h height. Flash embedding can be achieved by passing variables to this function in XHTML. The following code:
<div id="flash">
<script type="text/javascript" language="javascript">swf('designyesky.swf','500','220');</script>
</div>
Create a div with the ID of flash as a container and embed a js script inside it. The variables are: file path, width, and height.
See the entire code below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Method to embed Flash in compliance with web standards</title>
<script type="text/javascript" language="javascript" src="flash.js"></script>
<style type="text/css">
#flash { width:500px; margin:50px auto; border:5px solid #03c;}
</style>
</head>
<body>
<div id="flash">
<script type="text/javascript" language="javascript">swf(designyesky.swf','500','220');</script>
</div>
</body>
</html>