|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度0 B& }4 N% P B8 Y: ?9 t
var marqueewidth=300% Z+ t# P7 y0 ?) I
//高度9 I8 R% |0 J1 G8 G
var marqueeheight=25
5 Q* @" r+ u& y( E8 Q4 z//速度(1-10)
0 N. s" m+ m# E; T" ]3 v ~var marqueespeed=3* X2 C) h* J* n P/ [
//背景颜色6 O1 Q/ M3 D! ^' E6 h& ?+ h
var marqueebgcolor="#FFFFFF"% a4 L; v1 M8 \
//是否能暂停 (0=no. 1=yes)?
$ L0 M3 ~4 w- f7 y; i8 h! }var pauseit=15 g* d+ F6 C( v% ~; Q
" e2 ?# M' \8 w' h9 J
//修改显示内容7 E+ A8 ^3 c v, v& f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- i" y' k5 |8 T! e
- j% u% W$ c- s, ~# k- h" {7 m3 N6 C y. _) ^
////下面不需改变////////////
" E; ~. Y' w3 t6 X$ H) F
$ B' h4 k+ r* B. Q6 i* T S( }var copyspeed=marqueespeed
, H) a1 s& Q) L2 Q" F# ]/ hvar pausespeed=(pauseit==0)? copyspeed: 01 x' n: h* }' G& M+ J
var iedom=document.all||document.getElementById) y( ~( _0 P' s( @9 m
if (iedom)6 E) m! K4 P# X( L8 Y6 z/ W* x- [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 C) d# B3 }1 K6 n- I9 yvar actualwidth=''
" Z I' S9 w3 d$ P: Kvar cross_marquee, ns_marquee
( z2 Y( J+ {# D! {. f3 q7 w+ [ T0 c5 {5 }
function populate(){- E% n2 r: y6 Q9 ]* N6 i
if (iedom){. e* ~% Y+ K, e) f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 d. ]% d4 Q1 G( |3 e9 Ccross_marquee.style.left=marqueewidth+84 R2 C" m! o; N4 V/ P
cross_marquee.innerHTML=marqueecontent3 X$ N2 A4 H' t' b# T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( ~5 w7 W3 K2 J+ F
}3 y- l/ d3 U! E9 _$ L4 s+ n
else if (document.layers){4 K7 z2 W) t. \5 A
ns_marquee=document.ns_marquee.document.ns_marquee2) b( @" u2 ~2 G( A# a' Y3 E
ns_marquee.left=marqueewidth+8 H" ~& x" o7 T" P, J& |' x" X) f
ns_marquee.document.write(marqueecontent)6 C+ a: N3 e8 k9 w
ns_marquee.document.close()
8 o& ]- W# W0 Q0 ?7 s$ Tactualwidth=ns_marquee.document.width
% ]: f: y' n1 F" s. v}( j2 ]: |2 i6 `) i p
lefttime=setInterval("scrollmarquee()",20)
- o |' b8 {5 g3 h: a, C4 Y. [}( N0 m. r$ Z* d* J
window.onload=populate
) I1 ]( n) Y( C" ]- W& b3 G. s+ w& P3 a' u7 e1 n0 k6 ~
function scrollmarquee(){+ E7 o8 w7 {; U; N7 K8 l( @+ J7 A
if (iedom){4 L1 u$ P; y3 d, o/ Z4 V" D1 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& j8 Z) V7 t1 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* D1 N3 A1 }4 aelse
4 P& s }; F7 q# W0 scross_marquee.style.left=marqueewidth+8, H: d# k4 U8 j
! ^3 W' E7 v0 k) D. D6 |} @, t& g) N9 N$ R% t, N& e# N( Z0 k
else if (document.layers){
! q, a/ [/ X: J: ]+ V F: j3 Tif (ns_marquee.left>(actualwidth*(-1)+8))
9 I; u' s$ C) b1 l" V9 jns_marquee.left-=copyspeed, m5 O) ]0 ?, l( }6 B# q: `
else
- _1 E0 d5 B7 |ns_marquee.left=marqueewidth+8, P5 \' C6 Y6 n, S: O) I- S9 ~
}
- @/ n4 b) O7 m3 y$ |$ p}, U$ f( z: d. J8 k( ~+ F' B x
% F8 {# {* ]4 p' A) {
if (iedom||document.layers){
& [) W" x9 j, kwith (document){' N# p+ X1 }7 F4 d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: ^- c# n# x7 F* c+ i8 Mif (iedom){
# p8 M: w& ]1 n; a* H6 T! owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( u9 b! e# c- Z0 f5 A4 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# Y# O1 C6 X2 u! Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& r) |8 Y" s' Twrite('</div>')
& j: C7 @+ P2 X7 L8 D}# j/ ^6 a/ `. H; F4 K9 t
else if (document.layers){2 k" r7 T" o( P7 [% y, f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ y8 d3 ^& ^, [$ X% r1 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. o. P! y: ^" u- e7 ?write('</ilayer>')
* j! }. \( g/ B, H}
8 z/ E: |( A" R; D, |3 @document.write('</td></table>')8 n- K: N5 N( \: u: R
}0 }* @+ R+ V: C% Z
}
2 M" U: y; c# Y% z</script> |
|