方法/步骤:
新建一个DIV,并且给这个DIV设置一个大的背景图;
<div class="topp"></div>
在这个DIV里插入Flash动画层的代码:
<script type="text/javascript">InsertFlash('/60.swf', 1003, 197,'')</script>
把需要的Flash动画,放到自己网站根目录下。
在网站头部标签</head>上面,放上以下的JS代码,用于插入FLASH播放器。
//在网页中插入flash
<script>
function InsertFlash(Flash,Width,Height,ID){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
document.write("width=\"" + Width + "\" height=\"" + Height + "\" id=\"" + ID + "\">");
document.write("<param name=\"movie\" value=\"" + Flash + "\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<embed src=\"" + Flash + "\" quality=\"high\" wmode=\"transparent\"pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
document.write("type=\"application/x-shockwave-flash\" width=\"" + Width + "\" height=\"" + Height + "\"></embed>");
document.write("</object>");
}
</script>
<script>
function InsertFlash(Flash,Width,Height,ID){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
document.write("width=\"" + Width + "\" height=\"" + Height + "\" id=\"" + ID + "\">");
document.write("<param name=\"movie\" value=\"" + Flash + "\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<embed src=\"" + Flash + "\" quality=\"high\" wmode=\"transparent\"pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
document.write("type=\"application/x-shockwave-flash\" width=\"" + Width + "\" height=\"" + Height + "\"></embed>");
document.write("</object>");
}
</script>
如果放入网站后不显示Flash动画层,请检查一下动画的路径是否正确,可考虑使用绝对路径。
以下是网站中插入Flash动画层的全部代码。
//在网页中插入flash
<script>
function InsertFlash(Flash,Width,Height,ID){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
document.write("width=\"" + Width + "\" height=\"" + Height + "\" id=\"" + ID + "\">");
document.write("<param name=\"movie\" value=\"" + Flash + "\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<embed src=\"" + Flash + "\" quality=\"high\" wmode=\"transparent\"pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
document.write("type=\"application/x-shockwave-flash\" width=\"" + Width + "\" height=\"" + Height + "\"></embed>");
document.write("</object>");
}
</script>
<div class="topp">
<script type="text/javascript">InsertFlash('/60.swf', 1003, 197,'')
</script>
</div>
<script>
function InsertFlash(Flash,Width,Height,ID){
document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
document.write("width=\"" + Width + "\" height=\"" + Height + "\" id=\"" + ID + "\">");
document.write("<param name=\"movie\" value=\"" + Flash + "\">");
document.write("<param name=\"quality\" value=\"high\">");
document.write("<param name=\"wmode\" value=\"transparent\">");
document.write("<embed src=\"" + Flash + "\" quality=\"high\" wmode=\"transparent\"pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
document.write("type=\"application/x-shockwave-flash\" width=\"" + Width + "\" height=\"" + Height + "\"></embed>");
document.write("</object>");
}
</script>
<div class="topp">
<script type="text/javascript">InsertFlash('/60.swf', 1003, 197,'')
</script>
</div>