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

|
网页之跑马灯文字特效
//修改宽度
0 g) F$ |4 P1 e! L9 F. L( q6 Svar marqueewidth=300" P3 a$ H z& Z. I! S5 w
//高度" h2 `) X# }! K6 C; \* e$ H: d
var marqueeheight=25! V; P* Z+ q/ c( d) M
//速度(1-10)
% `( [( H8 }5 R# l) a6 uvar marqueespeed=3
$ y" C& [. j2 E2 C4 C# e//背景颜色
7 t( N! t3 F. U, ]var marqueebgcolor="#FFFFFF"
( R0 ~0 B/ A- I* q//是否能暂停 (0=no. 1=yes)?& D4 T1 T) z' r5 `
var pauseit=1* T q3 a E% ~% Z0 D, S6 w+ m: o
- c1 H4 \; W: W8 B$ B//修改显示内容
- l0 \$ x* o/ j3 Z1 ]var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 o3 {2 W3 A) n, u. |" }7 C/ ^& G8 ]
* S% V4 a, `6 o% ^
2 _$ |% S# S. p6 X9 J" |
////下面不需改变////////////
3 f; X, q* n1 l3 Y2 J6 q( T8 N7 `1 g! e
var copyspeed=marqueespeed) y3 @( `( A9 B. A( S
var pausespeed=(pauseit==0)? copyspeed: 0
8 U3 w8 D+ K# K9 n2 |% z$ J! {var iedom=document.all||document.getElementById. W- I2 Q! y# g, ^" Z1 V9 J
if (iedom)
6 u" b; I5 N, ?, M# [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( n, ]+ b. w7 ?9 b2 Q, M% W
var actualwidth=''
7 I+ X A( w6 s( w1 A avar cross_marquee, ns_marquee- I7 a+ d: p1 l: D: x3 A
3 Y+ J& @( I6 r! p' P( pfunction populate(){
& ^- f' G9 o2 fif (iedom){8 S0 f# r0 L: O0 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 N; L3 v. T) k! \5 r, H
cross_marquee.style.left=marqueewidth+8! w: D" {$ d5 q) W6 G2 p6 \
cross_marquee.innerHTML=marqueecontent3 ]6 F+ y, H7 H) |/ \( C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' T6 O4 b* F+ u( n
}3 `3 K6 R3 h2 k0 w
else if (document.layers){
; C8 w! H7 S8 T# P; z7 K" ?ns_marquee=document.ns_marquee.document.ns_marquee2% x/ ]7 Q# g2 {. l. J5 p( C* ~. S. U
ns_marquee.left=marqueewidth+8
Z8 y& P; x7 I* u3 s3 u; N, ans_marquee.document.write(marqueecontent)8 h/ ~; N' O( U2 z: G# |: d
ns_marquee.document.close()% T1 e6 _: H* X- s
actualwidth=ns_marquee.document.width6 ^" p1 B/ v- |3 w5 M4 P0 \
}
) J6 y3 N2 T" \- J; U8 ylefttime=setInterval("scrollmarquee()",20)
0 a4 w& M; ?! z+ Y: l0 o4 A0 b}
7 G6 r- c1 r6 g0 @0 g2 Twindow.onload=populate
# _7 k. d% _! Z i, k, @& J; B- g! D x( J: L1 Q8 ?
function scrollmarquee(){ K; C. S4 y) k. I
if (iedom){
, ?! l- l1 X2 R! m+ rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" ^/ e+ E' [1 t( s! p% a5 ]6 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ I. W! J6 j1 g2 {3 v
else
" X- u" y* p1 ^1 x6 F# l' F' Icross_marquee.style.left=marqueewidth+8
; J0 W/ G6 Y' V1 G
! ]* X& z7 @7 g: o, Z1 r}6 g( p2 P `( S' J) B& f
else if (document.layers){# n: m: D2 n( L; @# V
if (ns_marquee.left>(actualwidth*(-1)+8))
8 I' ?+ @/ X* I0 @ns_marquee.left-=copyspeed4 `* W0 `/ q, u6 o
else
. [! @7 G, v) Q L( w& l+ Kns_marquee.left=marqueewidth+8
$ s/ o& w7 {: P; t, a}
) i% F t) ]) l: H}
# W1 \1 Z9 k: D0 t. f3 `2 E9 u+ W
if (iedom||document.layers){. u1 `9 g& J- h6 c+ [( D
with (document){
" F* k8 C, U$ B# H9 ?) edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ `5 k5 y' @% Y8 wif (iedom){
0 h7 r0 H+ j8 Q& x( v4 @/ T0 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' O/ A) n, X. b4 o9 ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 l! ^0 d* v: S2 O$ y# E, X( B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ x1 i t% {9 J' w/ R: fwrite('</div>')% v0 I. q. c, Y9 n
}
% E2 P0 b" ]+ [5 ?, P" _else if (document.layers){
4 i/ e# B- z6 a) s9 n' hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. ?# `# a+ [' p5 P+ k4 g6 H: G* \ Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 E. }1 i. i" W
write('</ilayer>')
; a$ X: Y, x8 a7 v7 E5 ?}
( r2 o# ^9 r3 N cdocument.write('</td></table>'). i0 g/ A: e3 L
}
& d$ }+ c9 S/ m6 f# A7 @}
* J( T- p( C0 b! _: F% _</script> |
|