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

|
网页之跑马灯文字特效
//修改宽度
Y1 o; k9 j& B) x0 P: Wvar marqueewidth=3007 ^) e" v% k9 O) G3 C1 u
//高度 U' c! R" O% A8 f9 @' W. ~+ }
var marqueeheight=25: Z) k. C8 ^5 P. Z! @( u( j/ \; Y- ]- H( g
//速度(1-10)* K6 Q2 v3 \' x5 Q* x
var marqueespeed=3. {# ~+ U2 r, M+ X% ~
//背景颜色' _: q+ O1 G5 r
var marqueebgcolor="#FFFFFF"
: x) ^' c* H8 N% {$ b//是否能暂停 (0=no. 1=yes)?4 X( P5 F' g1 W1 O7 Y6 Z
var pauseit=1. q7 l$ u' e$ e: I
$ f! p* W! ]: R" S//修改显示内容5 _ p2 y$ b* T2 `* g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* U# Q9 b& w" B$ H, v: L2 E
1 Q0 s6 W8 G; i+ m, a0 m; v7 G% A8 U" w3 t( G' ?: _$ h
////下面不需改变////////////
. u2 |3 D# `+ s( N; A& M4 t; [0 w4 D. H- m
var copyspeed=marqueespeed
" Y8 H% o' t, o6 f! `var pausespeed=(pauseit==0)? copyspeed: 0
$ K0 i( z' \ m/ gvar iedom=document.all||document.getElementById, E: o% K- [+ C1 b* |2 V0 y9 q6 A
if (iedom)6 s R- g) r5 |5 |: o( d! L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 D% \8 _7 Y8 R9 H( O9 f% l% \
var actualwidth=''! x5 o3 v; J( ?1 H
var cross_marquee, ns_marquee( i- ?' ?/ D$ e' M$ G# @* Q) O
6 X2 x# t3 z# ffunction populate(){
5 x3 t) k" k: b3 \4 j7 q- |if (iedom){ f, x* S% m H6 T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ \+ l% V2 i8 j2 K0 |2 Z8 [- P
cross_marquee.style.left=marqueewidth+8* b/ A6 q2 S3 A
cross_marquee.innerHTML=marqueecontent) S( ^3 |; p; c/ Z. q q/ E4 `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 d0 g4 f3 U( \' ^! f$ d}, n0 t4 I% r1 K7 ^; L+ |3 Q7 _% F/ d
else if (document.layers){
3 w1 S: i0 Z; _1 Ons_marquee=document.ns_marquee.document.ns_marquee2
3 ?1 c! ?6 w, n) [0 @" {ns_marquee.left=marqueewidth+8- q+ S" D! E& q' H& N' P9 P5 p O
ns_marquee.document.write(marqueecontent), x' ?- d# q7 v; C6 ^2 w+ \7 g
ns_marquee.document.close()# c" Z3 c5 _- d
actualwidth=ns_marquee.document.width) u8 g& G" X4 f# z- U1 V, f
}
" f3 @) W0 C" A0 Tlefttime=setInterval("scrollmarquee()",20)- e O4 q: z k+ e. Y) {' p F
}$ |/ [2 A( I; ~2 p% O9 N' k! g, e4 `
window.onload=populate
( P1 O5 x8 ~( L2 n" J
4 y- s# Q: L* N2 z" `4 Hfunction scrollmarquee(){
4 t2 \5 m; T$ f! Yif (iedom){
# M- }; }* ^+ g* r6 z# v% qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' d: l6 r6 y3 u0 x5 Y8 D1 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) ~/ |- H' A' ]5 ? C' A* melse
* \+ m7 n% a3 q: ccross_marquee.style.left=marqueewidth+80 l/ _0 u7 Z" @, Z+ j) F+ D2 B
! A$ a- `1 Z( R/ x* l$ M1 T* z
} q* B! G3 t& L, G W
else if (document.layers){
3 z8 z) @2 h$ U" Gif (ns_marquee.left>(actualwidth*(-1)+8))- Z# S# }" S- ^
ns_marquee.left-=copyspeed
& x% o8 G$ A1 Q5 R4 ~else) X: o0 Z1 W6 N8 e6 F) w$ l
ns_marquee.left=marqueewidth+8
6 P5 a" {% G- }3 k) o}
6 B0 a4 ]: D7 U1 R0 F; r% J$ q: y}
0 V6 {2 X9 X$ N Z* ~/ C \& i/ z1 S. `2 W2 @) W) n% S
if (iedom||document.layers){
; S! z. g- ~, a& T* ^8 ~ F$ twith (document){/ [1 _: `9 K# O+ o% h) C; p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 G8 e# U! k% O1 A& j! Q
if (iedom){
% O4 T, L- g) b8 n7 L) \# w2 Y# Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 `" l9 Q% b8 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 f1 |2 }" A5 {$ V. A/ Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') Y5 S+ R; h5 t" J$ d- y
write('</div>')
" A& [' }5 j7 k8 T$ _) h} W- z0 _: Y, w. l( b2 D
else if (document.layers){
1 T5 z- P( h+ d- ]# Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 _6 n3 V% {% B6 {' z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 Q9 {* S8 P8 m3 M) x. u, Dwrite('</ilayer>')( M7 t: T8 z/ n% ?( C
}
/ L) n' W5 C9 q7 F5 ?document.write('</td></table>')
6 M0 y7 x6 ^# W6 U4 T' Q1 Z% {% n}
1 O S7 H$ D# @; e# |( H4 ]/ |}
% X3 ]6 f' @* z+ Z. n8 U; ^& Q4 P</script> |
|