返回列表 发帖

网页之跑马灯文字特效

//修改宽度: ~4 ^! N# Y. q  z9 f
var marqueewidth=300: ?3 E$ F: P9 Y$ a2 p& @+ U
//高度: M9 x( \9 W2 L( G% W- W
var marqueeheight=25
7 T6 ~' C1 ^/ `7 H0 W//速度(1-10)
4 Y# o& z* Y. L9 i' wvar marqueespeed=3
. q- b; @# e$ O' H' s4 c//背景颜色
' v. W0 m4 z0 B  A: _6 |var marqueebgcolor="#FFFFFF"
6 T. m0 }2 W: H# {+ B' [  L( b//是否能暂停 (0=no. 1=yes)?( J8 ~: [) f: Z: [# _
var pauseit=11 y, O; p$ p0 n- T$ ]- ]1 Y' e

- j& P& O; [, P7 w5 h- S//修改显示内容
+ L- G  d+ c6 o, N# i. `5 y$ Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! p2 C% z$ x- n8 F6 P8 Z0 l$ f5 |5 c# U: ?$ x5 [# Y7 v
9 w- s( N4 t: U
////下面不需改变////////////
( H$ m  m7 d0 [2 ?- Y* K/ a0 y5 b2 a4 m* @, D/ C' G  V, U
var copyspeed=marqueespeed
/ P( `& I/ u; V+ n8 xvar pausespeed=(pauseit==0)? copyspeed: 0
/ G& S: A. \" @" y5 K- Q0 q" Bvar iedom=document.all||document.getElementById% z/ X" B" G0 t) O, F# x( K. G
if (iedom)
0 [1 H- l  S( H+ |: W* mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 e" u' t  Z2 f# p# J7 U
var actualwidth=''& f/ G. {: V  Q! |
var cross_marquee, ns_marquee
- M" G& A# v8 m) n
( S* i0 p6 G! x# ^6 g7 wfunction populate(){
1 C4 h) J' g- y; }# e  B' |if (iedom){
6 \! J) Q( N7 `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% Y' B5 M4 _; d# m& |7 O4 rcross_marquee.style.left=marqueewidth+85 q2 c7 V2 i; ~8 C: F* x
cross_marquee.innerHTML=marqueecontent) p! n7 n/ t; }' M7 k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; ^& @4 ~9 B- k: E; U  ?4 [6 u
}' R- o9 n$ V6 m
else if (document.layers){
- b; g9 f; p; g# N" [- Lns_marquee=document.ns_marquee.document.ns_marquee2. d5 @7 n, R6 y! x0 G
ns_marquee.left=marqueewidth+8) `0 E' j' s# [8 N' b5 h
ns_marquee.document.write(marqueecontent)
9 E1 f# ]( L/ Z* c! _1 `, K: Gns_marquee.document.close()5 j% w7 N7 I$ `
actualwidth=ns_marquee.document.width
. d( F) M( d/ t& t5 a' q}
/ }% C: k; _, c. x9 blefttime=setInterval("scrollmarquee()",20)0 m& u, N7 T; ?% g6 l
}
7 U, L, m0 _$ \& d  B, Jwindow.onload=populate3 Y$ e. l& H0 H/ n8 G4 |: u
" K7 w. o( W( g
function scrollmarquee(){; A: m8 C. s% l& F
if (iedom){
7 ^% a. x% P3 k. e9 I8 Q* N2 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), o+ B+ @' p  i6 U8 H% F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) Z" P1 s' F7 z; c+ b' i" G
else
6 t  o7 Y* e- gcross_marquee.style.left=marqueewidth+8; g  Q$ {1 T  P! A& D: F
1 U, N# `/ E  ^8 i- Y# G
}. k; y' o0 m2 x6 `8 X/ X
else if (document.layers){' s  _( I0 ^+ y- R# y
if (ns_marquee.left>(actualwidth*(-1)+8))+ y6 Q+ K% ~/ h3 x3 c
ns_marquee.left-=copyspeed4 s6 @6 B$ }1 K+ ]
else9 f/ r, b" X1 B' H6 Z
ns_marquee.left=marqueewidth+8. ?& p: ~- W. _; \! O  i
}) C# h3 r3 H( j' z' B' P1 `7 u
}
% E0 d+ W6 l$ A; ]6 t" a9 r$ X% K
if (iedom||document.layers){
/ n# a  d8 z, z  L; u/ Vwith (document){
8 U) ^5 }: R3 L" {; I6 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 _2 `$ \. C6 }% r3 v. V6 d( c$ |
if (iedom){
3 v8 O) w% |6 Y' Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 [% g7 W3 a- @/ wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* S0 H, e0 L. @. n( [& [2 b, m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 I: G2 S! L- h( t3 {/ S
write('</div>')' N* y2 |+ T6 Q
}
9 Q2 W" p2 d# T# Celse if (document.layers){7 z3 u9 R- P! c
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; o6 a, h- H  \- N6 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 |2 ?( S" p/ \* ~write('</ilayer>')
: F5 b8 m/ M$ q4 e}
4 M" W  A. j) rdocument.write('</td></table>')
6 i5 `+ T7 ?* m9 ~9 N}
( n/ I( V/ w& @" P5 v. U" J}$ X9 W$ y3 j( v
</script>

返回列表
【捌玖网络】已经运行: