返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" i2 F% s) U7 E, F/ X+ R1 {var marqueewidth=300
3 }- W1 d3 @* ]: v' Y  F; g//高度
' W$ |' q$ t& B0 k/ nvar marqueeheight=25* |$ N& V9 Y" v7 P5 g
//速度(1-10)4 T8 f8 C* ~; j* U. Z  R
var marqueespeed=3
+ \9 \. }) I9 L- ^% w//背景颜色
# f9 ~4 {: N8 N, j% avar marqueebgcolor="#FFFFFF"$ `4 c# k: q" b  x6 b* r
//是否能暂停 (0=no. 1=yes)?) B! d5 H) A( _7 X6 i$ ?4 Y! d
var pauseit=18 l" b+ j6 r3 U+ D+ Y

) U- w/ q. y4 [//修改显示内容
0 e8 t8 i* A+ y3 X: S' t3 J& Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 X! ~( X7 s$ ^& l
2 _" ^; l! w+ a% v( N. G
8 z$ Z2 Z% i4 [0 t) J7 [( \) ^; R////下面不需改变////////////
( z/ R& ?5 W) R5 x7 j" }: |/ s/ d1 F
& F6 `& P$ N/ H( W( Z+ Nvar copyspeed=marqueespeed. g# d& r9 T( r$ v
var pausespeed=(pauseit==0)? copyspeed: 0
+ i' Z! |# {3 I' }var iedom=document.all||document.getElementById. B7 m* D2 C+ o: G. r3 N7 ?3 Y/ T
if (iedom)
% E+ n0 V! w% c2 g6 qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ E# r' p2 K. G" v( b% Lvar actualwidth=''
! {+ _! J& Q9 f6 v" a' g* M# Svar cross_marquee, ns_marquee2 ]4 p* B! T) Z  H  l% V, G# H
4 z3 ?# b& L" k$ [5 l4 \* X
function populate(){
$ V+ K" T6 \- Y2 x& Qif (iedom){
% t; U6 ^3 G. d. r; pcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ m9 h6 b% W# T6 [% r; |- d* T
cross_marquee.style.left=marqueewidth+8
* v1 v$ Z5 p7 |1 O# Rcross_marquee.innerHTML=marqueecontent
9 _+ i7 ~2 M* e1 Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* j4 s- B8 i: [' `  h}
5 N4 ?* ]' N. W' V0 yelse if (document.layers){) x2 d% I+ ?5 L
ns_marquee=document.ns_marquee.document.ns_marquee2" F4 D; p$ x" U; @# F& {) J3 S; F
ns_marquee.left=marqueewidth+8  V9 ^! t6 j& X, r5 z# d! G2 P+ M" \
ns_marquee.document.write(marqueecontent)( ?9 z* I& ^, l8 `0 ]
ns_marquee.document.close()0 h" N7 y; y3 k9 O  x
actualwidth=ns_marquee.document.width. k$ i1 |% F7 O7 e9 y+ @4 v
}: f$ T. I* F/ K. @
lefttime=setInterval("scrollmarquee()",20)
# L2 r, m) P' v}3 H3 p! o- ?9 q7 b$ @* \+ W
window.onload=populate2 Q! p; H+ q5 a

3 E; E5 H" x4 i/ X2 vfunction scrollmarquee(){8 z0 q0 Y/ k" P! g4 X
if (iedom){8 p1 T* _; }& B# b$ J5 r( P; }
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 L, d; b! t9 ~& T) b' Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) L! W/ G/ C! D7 a# P- g6 N4 Nelse
7 R8 P% j" T4 t% ucross_marquee.style.left=marqueewidth+8
$ I  D4 A$ F8 E3 k+ a( o7 M; x* ^3 a4 v3 ?; }* |# a
}
2 S; ~5 B. U' D( }else if (document.layers){
, V; Y; m$ N$ m1 s$ ~if (ns_marquee.left>(actualwidth*(-1)+8)). T* U* w2 a$ ~5 B# T, a( k% f
ns_marquee.left-=copyspeed' Q- A1 T& P, w" z; j1 Q8 L  a
else
  I4 d( m( B+ y( s  O+ Y6 Lns_marquee.left=marqueewidth+8
" p: ~6 H; ?: |  E4 e/ e# d}
0 k6 |- d) j4 d" q  ^, X+ A}
+ m$ u$ i/ L0 p# a/ q3 V# y# H+ J! Z. S/ z
if (iedom||document.layers){
; v$ ]# f5 o2 e6 P' Bwith (document){
# B. G7 F! ]$ ], x- |. j6 P( Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  b+ Q1 Y$ r; J' W2 A+ ?. i
if (iedom){
- P% B6 V9 T! K" F# Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- J  v) ^4 E: {& l7 f# L+ [' c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! @* n7 e! a3 i2 ~write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 c2 g% O  ~. b" j' Y) ^
write('</div>')5 g- K8 z6 H0 @" P
}5 ?- _/ X4 H( g( c
else if (document.layers){
" [8 v8 Y, _0 A2 C% @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& ^/ J0 X8 E2 o0 J5 @# A! Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. u$ M* u- z% E. C6 m; jwrite('</ilayer>')
' V5 I4 O5 ~+ L+ v}
* H( y* v  n* J2 L' x  Gdocument.write('</td></table>')
. r" C# d/ T" r, s: O( G' Q}
' l; f/ v7 K3 ~3 W% y}8 X' i. D- v* U6 M
</script>

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