返回列表 发帖

网页之跑马灯文字特效

//修改宽度" `. l* o! h' ?! v7 D( U
var marqueewidth=300
: V' _; C: g! z1 T5 s+ D//高度
# ]! a) k( U/ e* S! \! {. U8 ?var marqueeheight=25: ^6 r1 Q9 C4 N
//速度(1-10)
" Y. ~3 s$ O1 W8 hvar marqueespeed=3
, v' e: p. }  X, s//背景颜色/ ]. S& E3 M+ F& p9 a9 X. ~) C/ U
var marqueebgcolor="#FFFFFF"
3 z# u( a1 u2 [3 Z3 ^; R, W+ a//是否能暂停 (0=no. 1=yes)?+ k( S) H  J8 [/ C+ T8 q
var pauseit=12 I  _( j8 L7 W/ H, N3 M9 o, i2 A9 y

& w8 n6 y' L/ ^1 B& p//修改显示内容9 ~' \5 T' k0 l: L6 F' Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! X. D1 C* E# n5 S( o
/ {% k$ g; n$ x
0 J" X8 {- ?+ w' i5 T# o" J) N3 }
////下面不需改变////////////9 a3 s( i) a, N, P8 j1 Q7 u! J% |

# g+ q, ]+ S! a& Z  q' Z9 nvar copyspeed=marqueespeed6 _9 P' ~0 X  V' ]6 j$ j* X9 r
var pausespeed=(pauseit==0)? copyspeed: 0& m, H/ l+ p* |9 y+ l3 X
var iedom=document.all||document.getElementById
( `! K. r( C, \- _+ o+ ]3 k% wif (iedom)
$ {0 A' ~" U0 `7 M& Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& V' q; K* \# R4 A, k
var actualwidth=''
2 K4 A5 X& B+ n% N. E" E; t; mvar cross_marquee, ns_marquee
- a& P* K1 I/ U) q$ S
$ h4 J2 U0 f" q- I; K+ I7 [' Zfunction populate(){
8 P8 e, J# Y% D4 |1 u0 b' h$ l& qif (iedom){
, j6 p( w! n# h1 t. B) e$ zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  k7 q; c; M6 U% R# Mcross_marquee.style.left=marqueewidth+85 O% J; E+ P, |. m: ^' N2 V, Z
cross_marquee.innerHTML=marqueecontent
. v! |$ Q* j! D/ B$ cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ C: `- g; \1 Q}, y, D& I( }+ n, O
else if (document.layers){
: d+ s' R& @' \( Pns_marquee=document.ns_marquee.document.ns_marquee2* R; U0 B+ Y. w0 x1 ~7 a5 @. e
ns_marquee.left=marqueewidth+8) [6 R6 W0 ~. b8 o
ns_marquee.document.write(marqueecontent)
( n3 g. x- a0 X, N( T4 Fns_marquee.document.close(). t" v7 ~! {: D. ]
actualwidth=ns_marquee.document.width/ c4 {  P  W- B" f3 S+ S/ \1 \7 p
}
8 B) A& i& K  I- V" V% `lefttime=setInterval("scrollmarquee()",20)
/ _1 j- z; i1 f3 Z" u% s7 u}
4 f) ~* p7 ?  P5 |window.onload=populate
0 T. W' ]) B0 o# P6 {" G
6 j  r- h6 k) rfunction scrollmarquee(){- W5 M# f9 d" K; v- `
if (iedom){
- x& H- p- @6 y  B+ w% j  \8 y; U! Cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* Z6 v/ j+ Y/ E6 A; u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! i  s: ^8 X- T$ }
else, S3 W* R# I9 P5 w9 r: l* P; R
cross_marquee.style.left=marqueewidth+8/ t/ V/ l; N! [8 Y9 S; U3 M
" r# n- V  c1 E' j
}: B* [! S" M, N. S% j2 [
else if (document.layers){
* B/ v: ^& k8 `if (ns_marquee.left>(actualwidth*(-1)+8))- D2 Y" L, l. a
ns_marquee.left-=copyspeed
: w7 S# b" O' N% [  |: Uelse
8 R1 g. q# R- U: v7 T! Lns_marquee.left=marqueewidth+8
$ K5 ?. ?% v% m/ m}
+ u; n$ z2 a1 ]}' f( ?6 J( |! I5 ?- G
3 g4 i' J" i8 o
if (iedom||document.layers){: K: k3 p3 f3 s2 v0 V4 y1 X
with (document){
0 U5 j8 U/ `/ _! Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 c1 t( j8 n# q: I. c% s+ ]if (iedom){$ ?0 H* j6 @) d2 b7 k% I: T9 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. n5 j) m# c! Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; q) ?: W) u! A: S8 J4 _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" D! s1 V8 b' K' z' {% R5 u2 \4 {
write('</div>'): Y' j/ `) q2 k" e
}
* d5 {( Q* R/ l; }' i9 welse if (document.layers){
; Z' d3 ?6 R  S1 ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 c- ]' U7 C7 awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); j$ }6 t; h/ h1 t
write('</ilayer>')6 |% B" i8 F" ~2 g0 d  X: Y
}
' J$ f( {9 x3 V5 g! fdocument.write('</td></table>')
7 i( |1 c: }$ u# `4 f6 M/ W}0 {1 L4 D0 g; B" u& F
}
4 M& W* F* _' [3 V  U8 P</script>

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