|
藍森林 http://www.lslnet.com 2006年8月25日 8:28
請教浮在網頁左右兩邊的FLASH是如何實現的?
有的網頁左右兩邊有FLASH,而且保持在中間問題,請問一下這是如何實現的?謝謝,敬等回答! |
[html]
<Script language="JavaScript">
var rightbar;
var coupletcode;
rightbar = window.screen.width-140;
coupletcode = "<DIV id=sidebar style='LEFT: 0px; POSITION: absolute; TOP: 100px; VISIBILITY: hidden;' width=117>32</div><DIV id=sidebar2 style='LEFT: " + rightbar + "px; POSITION: absolute; TOP: 100px; VISIBILITY: hidden' width=117>32</div>";
if (window.screen.width>=1024)
{
document.write(coupletcode);
}
function InsertCouplet()
{
if (window.screen.width>=1024){
document.all.sidebar.style.visibility = "visible";
document.all.sidebar2.style.visibility = "visible";
document.all.sidebar.innerHTML = "<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 WIDTH=117 HEIGHT=270 id=leftFF ALIGN=> <PARAM NAME=movie VALUE=http://images.sohu.com/cs/button/youpai/120270812b.swf?clickthru=http://goto.sohu.com/goto.php3?code=youpai-sh47-frduilian> <PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent> <EMBED id=leftFFG src=http://images.sohu.com/cs/button/youpai/120270812b.swf?clickthru=http://goto.sohu.com/goto.php3?code=youpai-sh47-frduilian quality=high wmode=transparent WIDTH=117 HEIGHT=270 NAME=you ALIGN= TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer></EMBED></OBJECT>";
document.all.sidebar2.innerHTML = "<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 WIDTH=117 HEIGHT=270 id=youFF ALIGN=> <PARAM NAME=movie VALUE=http://images.sohu.com/cs/button/youpai/120270812b.swf?clickthru=http://goto.sohu.com/goto.php3?code=youpai-sh47-frduilian> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent><EMBED id=youFFG src=http://images.sohu.com/cs/button/youpai/120270812b.swf?clickthru=http://goto.sohu.com/goto.php3?code=youpai-sh47-frduilian quality=high wmode=transparent WIDTH=117 HEIGHT=270 NAME=you ALIGN= TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/go/getflashplayer></EMBED></OBJECT>";
}
}
InsertCouplet();
function leftFFG_DoFSCommand(command,args){
if ((command == "SohuCLFS")&&(args =="hidecouplet")){
document.all.sidebar.style.visibility = "hidden";
document.all.sidebar2.style.visibility = "hidden";
}
}
function youFFG_DoFSCommand(command,args){
leftFFG_DoFSCommand(command,args);
}
<!--
if (document.all){
document.write("<Script language=\"JavaScript\" For=\"youFF\" Event=\"FSCommand(command,args)\">\n");
document.write(" leftFFG_DoFSCommand(command,args);\n");
document.write("</Script>\n");
document.write("<Script language=\"JavaScript\" For=\"leftFF\" Event=\"FSCommand(command,args)\">\n");
document.write(" leftFFG_DoFSCommand(command,args);\n");
document.write("</Script>\n");
}
//-->
</script>
[/html]
還有一種隨滾動條動的,一時找不著了。 |
怎麼看不到效果呢 |
怎樣才能做到不管滾動條如何拉動,這個層在窗口中的位置始終固定不變,
而且不管瀏覽器窗口的大小跟滾動條滾動都在那裡
差不多就是這樣了,使用setInterval調用定時調用一個函數重寫一下要變動層的位置。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> test </TITLE>
</HEAD>
<BODY>
1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>1<p/>
<!-- 一定要給層加上id名,在下面的函數中將用到 -->
<div id="etang_left" style="position:absolute; width:100px; height:115px; z-index:1; left: 20px; top: 80px"><iframe width=85 height=434 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no bordercolor=#ffffff src=http://ads.etang.com/html.ng/SpaceDesc=homepage&location=left1>
</iframe></div>
<script>
<!--
lastScrollY=0;
window.setInterval("renewplace()",1); //更新層的位置
function renewplace()
{
diffY=document.body.scrollTop;
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
etang_left.style.pixelTop+=percent; //層的垂直,離瀏覽器上沿的距離
etang_left.style.left=document.body.scrollLeft+10; //層在水平位置,離左邊的距離
lastScrollY=lastScrollY+percent;
}
-->
</script>
</BODY>
</HTML>
|
|