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

|
网页之跑马灯文字特效
//修改宽度
5 m& J4 B7 i3 a1 k* W, s- t% Cvar marqueewidth=3000 S2 k% n$ B% A( n: ~% S( g1 G
//高度* V' Y2 u$ q9 ?( P' U6 w$ }+ w
var marqueeheight=25) R$ z- d+ x u- K% n
//速度(1-10)
/ M2 B3 P+ J7 w& w9 f/ w! J& J9 nvar marqueespeed=39 A( U# r# m9 Z3 {( r1 m8 J `
//背景颜色% S! B5 q' N- _
var marqueebgcolor="#FFFFFF"; j9 s" |' c; y' s, s
//是否能暂停 (0=no. 1=yes)?1 \' r% K8 @" `+ h0 ?/ J
var pauseit=1
* J* {- D u8 T- G# X4 g
7 t3 E# l' v/ H0 d" \4 B//修改显示内容. n, A2 k# v0 s! |7 S5 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 W% _. m t/ o0 A0 c# q& Q
0 }8 _. g' N+ h* \6 W6 n1 J! m+ L
. ?6 i: W# U7 _ w4 {8 Y////下面不需改变////////////, x/ c/ P' j. e5 F( b2 n5 w9 j! s
: v% i! H, y' f6 _. A7 `9 Tvar copyspeed=marqueespeed
, A9 p9 w$ Z9 w& S: k, {5 b( i! Xvar pausespeed=(pauseit==0)? copyspeed: 0
I5 n/ R% t" I5 d T0 x% Ovar iedom=document.all||document.getElementById
5 B ]' L B# W2 P. n& Fif (iedom)
. |9 M% {- N7 t$ Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% e2 }( I0 N* U( w6 c0 ], U. H
var actualwidth=''* E; b3 y0 B+ f" t- [! B
var cross_marquee, ns_marquee/ f- U2 P3 t; ]
1 M6 |0 a+ N/ b* l- L9 T- Y& H+ ]5 L
function populate(){
w6 z( ?" h! Wif (iedom){1 l! ?9 U" I8 u4 k# X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; S% t6 x: |& j( {" j
cross_marquee.style.left=marqueewidth+8, {. c8 I P/ `5 n" |
cross_marquee.innerHTML=marqueecontent
5 V( T0 M. R6 X- h6 Z5 @! uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth ~+ C d( a& e0 N, g* u Q7 t, x! l
}
! Y* R9 ?+ m- zelse if (document.layers){* v( M# S0 P `. {
ns_marquee=document.ns_marquee.document.ns_marquee2* I( b' k8 D& i$ g& r" n
ns_marquee.left=marqueewidth+8
2 G2 `6 }8 A: Ons_marquee.document.write(marqueecontent)
! G$ v4 b7 U' @! W8 \9 @7 zns_marquee.document.close()7 m8 v5 O" \) }6 d! g, o! e
actualwidth=ns_marquee.document.width& s$ x" R7 W% K5 n0 \
}2 @3 ~4 s, ]' _/ F3 x4 B m
lefttime=setInterval("scrollmarquee()",20)
( K( C" E8 ~; Q! y: @( ]5 i}
/ G0 P9 k' N |2 Twindow.onload=populate
' L! ^- q# R! v/ `& E2 t; R# b3 ]1 x+ I9 t2 p
function scrollmarquee(){
! y' ^2 X# N+ a, C% Nif (iedom){
2 s% f# w4 C' s" T+ z1 C; u0 q$ Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: w4 D% H% ~' |- T# R, rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 s/ X' a& k r+ P
else6 j# D1 T* x5 o* k) n- g2 L
cross_marquee.style.left=marqueewidth+8
( k" }- x2 j: c7 D3 j, `! h: O/ {5 {. u# D2 M
}
3 a: a) {4 r3 @* }6 F4 Yelse if (document.layers){
# J; a ?0 o: m0 R# e0 Cif (ns_marquee.left>(actualwidth*(-1)+8))& Q P2 _( D! q2 ]8 P. q
ns_marquee.left-=copyspeed, \5 U# L) o) k$ }# }
else
6 G/ x" E! W$ K' o/ \# uns_marquee.left=marqueewidth+88 V+ k3 f* ^) l( b( \
}
; e+ w2 ?, S8 e; E}6 a# K# |7 T! y- t2 t. x2 U4 m; B) x
; Y8 ^/ O: H- C
if (iedom||document.layers){% b4 r7 x5 o2 C1 X. u m3 y
with (document){. i$ B p: `; P& ~2 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 N* I# G" b8 X" B. P/ w6 e" z' gif (iedom){
7 {7 }% N" p, z/ @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# t C: p* `- x! Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 ~6 J5 f# I; s4 L, {' q! x# [7 h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# s5 \, I- Z; T5 Z4 a/ ?+ X
write('</div>')
8 _; T3 B7 g1 c* P& \4 O7 m}
, ?- ~9 i4 r1 \" Pelse if (document.layers){
* h+ X2 K! ^" w# ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 E( q7 }6 P) U( y8 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: g2 _% D, m% d8 [& q3 kwrite('</ilayer>')
& M) h. `& n( K" S}; h' c5 T) M4 u" s% M6 R, T
document.write('</td></table>')4 d4 y, F% e' @9 x; K& a
}$ A. k! v; _: \+ w6 @
}
% U. _, g5 m' i5 e& A3 G</script> |
|