複製代碼代碼如下:
<! - 開始->
<style type =“ text/css”>
#MSG_WIN {位置:絕對;右:0px; display:none; vellflow:hidden; z-index:99; border:1px solid#c00;背景:#f9effc; width:210px; font-size:12px; margin; margin:0px;};}
#MMSG_WIN .ICOS {位置:絕對; top:2px;*top:0px; right:2px; z-index:9;}
。
.icos A:懸停{顏色:#ffcc00;}
#MMSG_TITLE {背景:#fa6705; border-bottom:1px實心#710b97; border-top:1px solid #fff; border-left:1px solid #fff; color:#ffffff; height:#ffffff; height:25px; line-height:25px; line-height:25px; text-indent:5px; text-indent;
#MMSG_CONTENT {MARGIN:1PX; MARGIN-RIGHT:0; width:210px; Height:160px; Overflow:hidden;文字合格:中心}
</style>
<! - 結束->
<div ID =“ msg_win”樣式=“ display:block; top; top:503px;可見性:可見;不透明度:1;“”>
<div> <a id =“ msg_min” href =“ javaScript:void 0”> _ </a> <a id =“ msg_close” href =“ javascript:void 0”>×</a> </div> </div>
<div ID =“ msg_title”>標題
</div>
<div ID =“ msg_content”>
<object classid =“ clsid:d27cdb6e-ae6d-11cf-96b8-44445540000”
codebase =“ http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version = 6,0,29,0”>
<param name =“電影” value =“ flvplayer.swf?vcastr_file = userlogin/video/qlg.flv&isautoplay = 1”/>
<param name =“質量” value =“ high”/>
<param name =“ allayfullscreen” value =“ true” />
<embed src =“ flvplayer.swf?vcastr_file = userlogin/video/qlg.flv&isautoplay = 1” glayfullscreen =“ true” quority quality =“ high”
pluginspage =“ http://www.macromedia.com/go/getflashplayer” type =“ application/x-shockwave-flash”> </embed>
</object>
</div>
</div>
<腳本類型=“ text/javascript”>
var messages = {
set:function(){//最小化與恢復狀態切換
var set = this.minbtn.status == 1? [0,1,'block',this.char [0],'最小化']:[1,0,'none',this.char [1],'恢復'];
this.minbtn.status = set [0];
this.win.style.borderbottomwidth = set [1];
this.content.style.display = set [2];
this.minbtn.innerhtml = set [3]
this.minbtn.title = set [4];
this.win.style.top = this.gety()。 top;
},,
關閉:function(){//關閉
this.win.style.display ='none';
document.all.xhs1.stop();
window.scroll = null;
},,
setOpacity:function(x){//設置透明度
var v = x> = 100? '':'alpha(opacity =' + x +')';
this.win.Style.Visibility = x <= 0? “隱藏”:“可見”; //即有絕對或相對定位內容不隨父透明度變化的錯誤
this.win.style.filter = v;
this.win.style.opacity = x / 100;
},,
show:function(){//漸顯
clearInterval(this.timer2);
var me = this,fx = this.fx(0,100,0.1),t = 0;
this.timer2 = setInterval(function(){
t = fx();
me.setopacity(t [0]);
if(t [1] == 0){clearinterval(me.timer2)}
},6); // 10至6
},,
FX:功能(A,B,C){//緩衝計算
var cmath =數學[(a -b)> 0? “地板”:“ ceil”],C = C || 0.1;
返回函數(){return [a += cmath(((b- a) * c),a -b]}
},,
gety:function(){//計算移動坐標
var d =文檔,b = document.body,e = document.documentElement;
var s = math.max(b.scrolltop,e.scrolltop);
var h = /backcompat/i.test(document.compatmode)? B.ClientHeight:E.ClientHeight;
var h2 = this.win.offsetheight;
返回{腳:S + H + H2 + 2 + 2 +'px',頂部:S + H -H2-2 +'px'}
},,
moveto:功能(y){//移動動畫
clear Interval(this.timer);
var me = this,a = parseint(this.win.style.top)|| 0;
var fx = this.fx(a,parseint(y));
var t = 0;
this.timer = setInterval(function(){
t = fx();
me.win.style.top = t [0] +'px';
if(t [1] == 0){
clearinterval(me.timer);
me.bind();
}
},6); // 10至6
},,
綁定:function(){//綁定窗口滾動條與大小變化事件
var me = this,st,rt;
window.scroll = function(){
ClearTimeOut(ST);
cleartimeout(me.timer2);
me.setopacity(0);
st = settimeout(function(){
me.win.style.top = me.gety()。 top;
me.show();
},100); // 600 mod 100
};
window.sonresize = function(){
ClearTimeOut(RT);
rt = settimeout(function(){me.win.style.top = me.gety()。top},100);
}
},,
init:function(){//創建html
函數$(id){return document.getElementById(id)};
this.win = $('msg_win');
var set = {minbtn:'msg_min',crolstBtn:'msg_close',title:'msg_title',content:'msg_content'};
對於(set中的var id){this [id] = $(set [id])};
var me = this;
this.minbtn.onclick = function(){me.set(); this.blur()};
this.closebtn.onclick = function(){me.close()};
this.char = navigator.useragent.tolowercase()。 indexof('firefox') + 1? ['_','::','×']:['0','2','r']; // ff不支持網絡d
this.minbtn.innerhtml = this.char [0];
this.closebtn.innerhtml = this.char [2];
settimeout(function(){//初始化最先位置
me.win.style.display ='block';
me.win.style.top = me.gety()。腳;
me.moveto(me.gety()。頂部);
},0);
返回此;
}
};
message.init();
</script>