25yicms利用ASP.NET(C#)+MSSQL技术全力打造功能最强大的营销型企业网站管理系统,企业做网站系统,做网站软件,提供div+css企业网站模板。
阅读内容

javascript控制浮动flash广告最简代码


时间:2010/02/25   来源:25亿
    对于企业网站,为了美观有时我们喜欢用flash显示在页面上面,像广告,公司公告之类的,一般都是放置在首页,能够吸引人的注意。但是对于浮动的Flash,我们并不是那么容易的控制,网上提供的一些代码都很类似,而且复杂,代码繁琐。

    下面讲解javascript控制浮动flash广告的最简代码。

    完整js代码如下:
function indexflash()
{
var domainurl=window.location.host;
var currenturl=top.window.location.href;
var temp_currenturl=currenturl.split("/");
//上述代码是指每个页面共同一个js时,区分首页
if(domainurl==temp_currenturl[2])
{
document.write('<div id="Layer1" style="position:absolute; right:0px; top:150px; width:160px; height:260px; z-index:99">');
document.write('<embed src="Images/02.swf" width="160" height="260" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"

type="application/x-shockwave-flash" wmode="transparent"></embed>');
document.write('</div>');
}
//用js输出层
rightBottomAd();//用javascript控制层浮动(居右下角随屏幕浮动)
}
function rightBottomAd(){
 var abc = document.getElementById("Layer1");
 abc.style.top = document.body.scrollTop+document.body.clientHeight-270+"px";
 setTimeout(function(){rightBottomAd();},50);
}

    用javascript控制层浮动就只有rightBottomAd函数,代码比较简单。
作者: SEO技术@ 企业网站管理系统
原载: 25亿企业网站管理系统
版权所有。转载时必须以链接形式注明作者和原始出处及本声明。
+上一篇 C#(asp.net)中用javascript实现倒计时代码
+下一篇 没有了
点击次数:       打印此页  关闭