asp的网站,怎么在头部文件放JS代码呢?
2个回答
展开全部
1.先建立一个flash.js的JS文件,并写入
代码如下:
function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
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="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}
2.在网页里<head>与</head>之间写入调用JS的代码:
代码如下:
<script type="text/javascript" language="javascript" src="flash.js"></script>
3.然后在网页主体内容里写入调用flash的代码(只要是flash都可以调用):
代码如下:
<script language="javascript" type="text/javascript">flash('images/01.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/02.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/03.swf','529','600');</script>
代码如下:
function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
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="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}
2.在网页里<head>与</head>之间写入调用JS的代码:
代码如下:
<script type="text/javascript" language="javascript" src="flash.js"></script>
3.然后在网页主体内容里写入调用flash的代码(只要是flash都可以调用):
代码如下:
<script language="javascript" type="text/javascript">flash('images/01.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/02.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/03.swf','529','600');</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询