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

|
网页之跑马灯文字特效
//修改宽度7 M# P; b9 [. o, E o. |) G5 ?
var marqueewidth=300* e7 G5 N% T5 _8 `; F
//高度% n! R& y0 Q1 T' F( Y A
var marqueeheight=25
* f6 m: c1 F1 o7 n//速度(1-10)$ l! x0 H5 B& h1 H. a* B" z) t/ g
var marqueespeed=3$ {' l) g1 ]. r: p
//背景颜色0 x5 V2 [( d& ]
var marqueebgcolor="#FFFFFF"
5 G4 Y9 ~- ^: r" b: _3 R. h, h/ W//是否能暂停 (0=no. 1=yes)?
* I6 g& [% u* ]1 a. ]! ]5 J( Y! ^var pauseit=1
7 w9 t" H, K/ q2 m$ j/ ]3 w/ b
2 i" [, L+ Z" c. a( }$ g//修改显示内容
: J) s. ]% G( k" k5 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 B h' o1 D) f" S* H* q- C! Z5 f }1 q9 M- h6 H. x' O
0 ^+ d, u8 D) I" `////下面不需改变////////////
% Y) a- N, `- E; i& Y0 O8 k7 V1 w5 @/ L: g1 ^3 m( X
var copyspeed=marqueespeed' K/ V0 i; A: C$ {6 B; A
var pausespeed=(pauseit==0)? copyspeed: 0
2 U2 W2 O+ K4 p H! Tvar iedom=document.all||document.getElementById
6 d0 M/ l _( w, Hif (iedom)* n& q# a' g9 t3 f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 Q; s1 X" ~: P2 mvar actualwidth=''
, p8 ]7 j4 I i& q, {, m: Cvar cross_marquee, ns_marquee
- q3 t1 v0 Z0 r# q* p& M
& i" S9 |! s( _ u+ b- E* N1 kfunction populate(){# G; N0 N% P2 P3 P6 V
if (iedom){
8 G- Z( n3 @( L3 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& |6 _7 Q d# R6 ?# T5 Tcross_marquee.style.left=marqueewidth+84 n; k! A9 G. J! g1 e) \1 D, C
cross_marquee.innerHTML=marqueecontent& T/ `( }, I3 ]9 k! s& `0 o: l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 s7 h3 D# d1 v7 p, H$ x/ Y}2 W" T; \$ M+ U4 @; c
else if (document.layers){
6 |! b1 B8 P$ y m# k" wns_marquee=document.ns_marquee.document.ns_marquee2
+ ~) _7 U* L S! E# h8 u' l7 vns_marquee.left=marqueewidth+8( |. G$ J8 _3 D2 X/ t
ns_marquee.document.write(marqueecontent)
" t8 A1 V6 v9 y3 r3 U& \ns_marquee.document.close(): l+ ^5 P: K3 Q! E) c) W
actualwidth=ns_marquee.document.width
! i$ `& u/ Y& g6 b+ ]) \& }}, c% [5 m' T, a. U
lefttime=setInterval("scrollmarquee()",20)/ t, B3 h, [4 K- `
}. u6 I( a, ~7 O
window.onload=populate
3 a+ K5 t, ~/ A3 a( H% ~8 l( E! U* x6 X) i
function scrollmarquee(){
7 `! J+ K D7 ] W2 C0 O# ^if (iedom){
4 |/ [1 I, q( R, }/ L9 }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! Q9 I8 H7 U& W% a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 P* c6 Y/ q' x7 F+ a. U; w# \/ Delse
" v7 ~( Y: g6 x: p3 g7 D4 ocross_marquee.style.left=marqueewidth+8' ]2 w( s, B/ `' D
0 O2 F4 w5 u% p; S7 ^- Z4 x}
0 ]9 r7 [1 ]+ e+ }. z1 Velse if (document.layers){
+ @, j+ h4 f: K# b" O" }$ K+ yif (ns_marquee.left>(actualwidth*(-1)+8))
2 w/ ]4 Z4 e, l: V# w }ns_marquee.left-=copyspeed: g5 |5 } c' F3 J$ F
else" \9 X& X' Z% j4 ^( ^* F8 F" d; D- [
ns_marquee.left=marqueewidth+84 H; H& |; s t4 h C
}
0 u4 D3 N% D4 \. m3 Z- W A5 l1 F( R}
3 H, r+ F- d, `4 h; S- P7 E0 Q# I
if (iedom||document.layers){8 x/ ]* s. x* L; r
with (document){
- P& [3 T" w9 idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# j% O5 W) [% c V6 D3 \if (iedom){
! S0 K# d {3 M! ~& swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" Z7 O; U. f& z* E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 h- H" G9 {9 q9 d( f* T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 c6 s. o1 N, K, C# { ewrite('</div>')' U: J0 |' J: r9 P% x! M3 I
}
6 J0 @9 d. l$ f1 t; x/ F6 `& Relse if (document.layers){
k7 ^ J( r6 x) m+ g1 zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 ~% v/ M) ` @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 r3 |* w5 j! Y8 \write('</ilayer>')
" P6 P: c6 U2 d; v( A}; L& r" m7 d/ V/ N: _
document.write('</td></table>')
+ a5 V. i3 b9 {2 d* H# F/ c}
U; S0 H8 t4 m' N* i5 d6 y}
3 L/ r# `: @- R- w) C8 O</script> |
|