<div class="codetitle"> <span><a style="CURSOR: pointer" data="2042" class="copybut" id="copybut2042" onclick="doCopy('code2042')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code2042"> <br><!--开始--> <br><style type="text/css"> <br>#msg_win{position:absolute;right:0px;display:none;overflow:hidden;z-index:99;border:1px solid #c00;background:#F9EFFC;width:210px;font-size:12px;margin:0px;} <br>#msg_win .icos{position:absolute;top:2px;*top:0px;right:2px;z-index:9;} <br>.icos a{float:left;color:#FFFFFF;margin:1px;text-align:center;font-weight:bold;width:14px;height:22px;line-height:22px;padding:1px;text-decoration:none;font-family:webdings;} <br>.icos a:hover{color:#FFCC00;} <br>#msg_title{background:#FA6705;border-bottom:1px solid #710B97;border-top:1px solid #FFF;border-left:1px solid #FFF;color:#FFFFFF;height:25px;line-height:25px;text-indent:5px;font-weight:bold;} <br>#msg_content{margin:1px;margin-right:0;width:210px;height:160px;overflow:hidden; text-align:center} <br></style> <br><!--结束--> <br><br><div id="msg_win" style="display:block;top:503px;visibility:visible;opacity:1;"> <br><div class="icos"><a id="msg_min" title="最小化" href="javascript:void 0">_</a><a id="msg_close" title="关闭" href="javascript:void 0">×</a></div> <br><div id="msg_title">标题 <br></div> <br><div id="msg_content"> <br><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" <BR>codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="210" height="160"> <br><param name="movie" value="flvplayer.swf?vcastr_file=userlogin/video/qlg.flv&IsAutoPlay=1"/> <br><param name="quality" value="high"/> <br><param name="allowFullScreen" value="true" /> <br><embed src="flvplayer.swf?vcastr_file=userlogin/video/qlg.flv&IsAutoPlay=1" allowFullScreen="true" quality="high" <BR>pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="210" height="160"></embed> <br></object> <br></div> <br></div> <br><script type="text/javascript"> <BR>var Message = { <BR>set: function () {//最小化與恢復狀態切換<BR>var set = this.minbtn.status = = 1 ? [0, 1, 'block', this.char[0], '最小化'] : [1, 0, 'none', this.char[1], '恢復']; <BR>this .minbtn.status = set[0]; <BR>this.win.style.borderBottomWidth = set[1]; <BR>this.content.style.display = set[2]; <BR>this.minbtn.innerHTML = set[3] <BR>this.minbtn.title = set[4]; <BR>this.win.style.top = this.getY().top; <BR>}, <BR>close: function ( ) {//關閉<BR>this.win.style.display = 'none'; <BR>document.all.xhs1.stop(); <BR>window.onscroll = null; <BR>}, <BR> setOpacity: function (x) {//設定透明度<BR>var v = x >= 100 ? '' : 'Alpha(opacity=' x ')'; <BR>this.win.style.visibility = x <= 0 ? 'hidden' : 'visible'; //IE有絕對或相對定位內容不隨父親透明度變化的bug <BR>this.win.style.filter = v; <BR>this.win.style.opacity = x / 100; <BR>}, <BR>show: function () {//漸顯<BR>clearInterval(this.timer2); <BR>var me = this, fx = this.fx(0, 100, 0.1 ), t = 0; <BR>this.timer2 = setInterval(function () { <BR>t = fx(); <BR>me.setOpacity(t[0]); <BR>if (t[1] == 0) { clearInterval(me.timer2) } <BR>}, 6); //10 to 6 <BR>}, <BR>fx: function (a, b, c) {//緩衝計算<BR>var cMath = Math[(a - b) > 0 ? "floor" : "ceil"], c = c || 0.1; <BR>return function () { return [a = cMath((b - a) * c), a - b] } <BR>}, <BR>getY: function () {//計算移動座標<BR>var d = document, b = document.body, e = document.documentElement; <BR>; var s = Math.max(b.scrollTop, e.scrollTop); <BR>var h = /BackCompat/i.test(document.compatMode) ? b.clientHeight : e.clientHeight; <BR>var h2 = this b.clientHeight : e.clientHeight; <BR>var h2 = this. win.offsetHeight; <BR>return { foot: s h h2 2 'px', top: s h - h2 - 2 'px' } <BR>}, <BR>moveTo: function (y) {//移動動畫<BR>clearInterval(this.timer); <BR>var me = this, a = parseInt(this.win.style.top) || 0; <BR>var fx = this.fx(a, parseInt(y)); <BR>var t = 0; <BR>this.timer = setInterval(function () { <BR>t = fx(); <BR>me.win.style.top = t[0] 'px'; <BR>if (t[1] == 0) { <BR>clearInterval(me.timer); <BR>me.bind(); <BR>} <BR>}, 6); //10 至 6 <BR>}, <BR>bind: function () {//綁定視窗捲軸與大小變化事件<BR>var me = this, st, rt; <BR>window.onscroll = function () { <BR> clearTimeout(st); <BR>clearTimeout(me.timer2); <BR>me.setOpacity(0); <BR>st = setTimeout(function () { <BR>me.win.style.top = me.getY ().top; <BR>me.show(); <BR>}, 100); //600 mod 100 <BR>}; <BR>window.onresize = function () { <BR>clearTimeout(rt) ; <BR>rt = setTimeout(function () { me.win.style.top = me.getY().top }, 100); <BR>} <BR>}, <BR>init: function () { //創建HTML <BR>function $(id) { return document.getElementById(id) }; <BR>this.win = $('msg_win'); <BR>var set = { minbtn: 'msg_min', closebtn : 'msg_close', title: 'msg_title', content: 'msg_content' }; <BR>for (var Id in set) { this[Id] = $(set[Id]) }; <BR>var me = this ; <BR>this.minbtn.onclick = function () { me.set(); this.blur() }; <BR>this.closebtn.onclick = function () { me.close() }; <BR> this.char = navigator.userAgent.toLowerCase().indexOf('firefox') 1 ? ['_', '::', '×'] : ['0', '2', 'r']; / /FF不支援webdings字體<BR>this.minbtn.innerHTML = this.char[0]; <BR>this.closebtn.innerHTML = this.char[2]; <BR>setTimeout(function () {//初始化最先位置<BR>me.win.style.display = 'block'; <BR>me.win.style.top = me.getY().foot; <BR>me.moveTo(me.getY().頂); <BR>}, 0); <BR>return this; <BR>} <BR>}; <BR>Message.init(); <BR></script> </div>