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

|
网页之跑马灯文字特效
//修改宽度7 f& c# w1 F3 ?( \6 s, ?# h0 d
var marqueewidth=300
( B- b8 v' m+ `) O//高度
/ g- m; t3 x" D, cvar marqueeheight=25
, i* C6 U+ v- D$ e//速度(1-10); j5 R" z& t6 T3 _" S6 z( h/ @
var marqueespeed=3; t$ w3 t( ], M. F) }) n
//背景颜色% e( H* A* `( s/ H5 x
var marqueebgcolor="#FFFFFF"" ]' X$ h) a p( X6 \2 f
//是否能暂停 (0=no. 1=yes)?
- m7 k* ~+ J7 Ovar pauseit=1. B8 J* Q1 o, w0 z! V
- q4 Q9 w+ p( m. H! l; X; M//修改显示内容& ~+ G9 o/ ]* a/ V1 W A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* ]3 H* _- s7 I
+ u1 Q& A8 i9 i8 x; [4 Y( _- N, Q" \1 q8 x% c0 C" }
////下面不需改变////////////
5 w1 Y+ w5 F2 J; G' h
" [# ~& D0 B6 r. [var copyspeed=marqueespeed
1 h5 R3 K1 o$ ^0 X+ Ovar pausespeed=(pauseit==0)? copyspeed: 0. ^" i* \+ K1 G+ N( q
var iedom=document.all||document.getElementById4 z2 |2 D) h+ c; k1 h) c
if (iedom)
\7 w6 R& t F6 }4 Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* S) t% f- ` c* N5 V7 i# T$ X
var actualwidth=''
6 R# e" b% c" L$ Z6 qvar cross_marquee, ns_marquee
0 D4 c: O1 G5 w7 L0 J
3 h' C6 S4 B. f: Sfunction populate(){
5 Y4 J* }* H; b4 T8 n4 A5 aif (iedom){
2 e' V) o' J* g* ^) _' c6 B+ hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: e$ ]% G% P, Q A; i) l Y
cross_marquee.style.left=marqueewidth+8
+ e3 u( F- ]) O' q. ?cross_marquee.innerHTML=marqueecontent
% D' a9 S3 b' Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 u" S% }8 Q2 j) v) E, i
}
1 K) v0 Z- A" Z; Xelse if (document.layers){
- s. K6 {! ]. S& a b2 ^ns_marquee=document.ns_marquee.document.ns_marquee2
& F" G9 ]) v4 e4 d2 c$ lns_marquee.left=marqueewidth+8; Z: n( d' m5 Q: J# |0 ^" b' v
ns_marquee.document.write(marqueecontent)# A( {: M, q. x) r! ^, X. D
ns_marquee.document.close()
+ p5 [7 w& L3 M5 D/ b0 Cactualwidth=ns_marquee.document.width
8 A6 B, B9 Y8 j" |9 P}
$ d( g! f6 p9 }' n [" b' u- ]lefttime=setInterval("scrollmarquee()",20)5 \' V3 o/ ~4 ? H9 a, K/ `* f
}6 p* J/ K0 |2 q& E$ X) o& i
window.onload=populate0 A- k% a+ m% z* @# a: y$ K
1 v; P7 r: p* u. s
function scrollmarquee(){9 S. Q' A+ I5 W+ N' m
if (iedom){
6 s- m6 E' e8 @* iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 L s8 z6 p- W3 z9 e& L# z ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 X, P6 B5 n& W. |$ ?9 V3 e2 E" velse2 v: ~/ T4 y/ f0 D
cross_marquee.style.left=marqueewidth+8
' J6 n. C5 R% G' s
0 W. \: _% ~9 x5 G}; p. g' S# \ c
else if (document.layers){
& r2 B1 R% Y# ^) \: d% o7 {! ^if (ns_marquee.left>(actualwidth*(-1)+8))
4 [8 Q9 H% w- \8 S# |/ {" ]ns_marquee.left-=copyspeed
* m9 X* u5 Q; O9 Oelse
0 ~! N6 \+ p ^7 `; @/ ~# i$ z- Ans_marquee.left=marqueewidth+8
. Q( N2 ^) J0 J$ C, ~; t$ v8 J}
- s+ `& d$ @ ~. U- ?' t}
6 o; F( b" h- b- ~2 ^2 y& h, k( x* H3 u+ [! }& B
if (iedom||document.layers){
: @( d8 [3 d; C7 \+ P8 _with (document){
8 X7 B1 }' e+ n1 ^& r; vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 @: m7 U. }+ r9 d# y
if (iedom){/ C6 c# Q4 e. P) \* ?% ~* W/ L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 j# F, P* [& D: A6 E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 w' P7 w2 q& u* {5 hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 g; N$ {- P! g# E. P# W c$ G
write('</div>')
2 j1 B5 ^, D# b}" d: C/ Z+ ~6 L3 s
else if (document.layers){; l$ r" L* O6 y- O. \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) A5 h, A& }0 y9 N7 _ X& ~9 [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 T6 U5 K _( d7 e8 H6 {
write('</ilayer>')
1 j& T L2 b! h% ~( ^}- y8 l. Y: O0 r2 V
document.write('</td></table>')
2 X5 k2 g+ |5 m: t6 C}3 X- N: v- {* x6 i; J% z8 c: k
}
, \- t/ e& `0 A6 i" n</script> |
|