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

|
网页之跑马灯文字特效
//修改宽度
( p9 P, b Y8 [( _$ bvar marqueewidth=300
- l* Z" U6 I& A! L$ ]" O4 H//高度/ g p2 `; b9 ~4 K& j6 E) K
var marqueeheight=25
+ |$ E4 v1 J$ }' D% {2 L+ b//速度(1-10)$ `, r! X4 _; f) |6 W+ }$ e
var marqueespeed=35 T8 z: l3 D" {) Q
//背景颜色+ {2 O7 V' \2 ?7 Y! t! b$ h
var marqueebgcolor="#FFFFFF"" }1 ]- R/ O* L. Y
//是否能暂停 (0=no. 1=yes)?
0 h. |# z/ I( ^$ H+ i. }) ~var pauseit=1
" C2 p5 ?! Y4 c9 Z
4 | a+ m! l, ?" y2 p//修改显示内容+ v( ~6 \$ U, H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 L' y( `; q; o
- v& X4 {+ O7 j6 m. `
$ k4 X1 M5 z* S////下面不需改变////////////
1 Q3 u$ N g+ J l8 h% ^! }+ c* @. d" |2 P5 W
var copyspeed=marqueespeed
) {& s& |. O- B0 V; N% n- ovar pausespeed=(pauseit==0)? copyspeed: 08 ^, `/ k0 m6 k! ?
var iedom=document.all||document.getElementById. g% G) I4 D1 i. B( k+ X
if (iedom)
9 c6 ^0 U( F6 R2 t0 Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! x! f6 N2 ]3 L% R) G
var actualwidth=''& f' W7 a W4 _- Y" m; f
var cross_marquee, ns_marquee
# g8 {5 f J: u6 K3 F
6 K- Z) U( ?- j& l: D' ofunction populate(){8 B) J' s! p" d! @. Y' B. o
if (iedom){
, K8 W% n3 |# H* c7 @9 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" n) h2 A, x& |0 T9 V. s" J( T% ~ w
cross_marquee.style.left=marqueewidth+8
6 b: U7 [$ ^( z* h( `) A. vcross_marquee.innerHTML=marqueecontent
( K ]2 i, u/ v% o3 d8 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 L. e8 H d2 }' q; t/ [/ U}
. f$ P9 g$ N6 ?# g$ Aelse if (document.layers){7 d7 \. E8 m k$ N( N8 ^# v
ns_marquee=document.ns_marquee.document.ns_marquee2
8 H! p2 a/ d. g; Ons_marquee.left=marqueewidth+8
" F! T# Q" y# _* U2 mns_marquee.document.write(marqueecontent)5 S. O% X, k: k
ns_marquee.document.close() {2 ~& m9 g+ p7 G+ L
actualwidth=ns_marquee.document.width- q ~( }8 i" i7 P6 S" r
}5 W# Z2 z' x$ v: w6 r7 i
lefttime=setInterval("scrollmarquee()",20)5 J5 G3 a* N3 `5 a& R4 S$ h/ U
}! W3 J, J& ~! J8 P9 o
window.onload=populate
( E. t' f1 `, h
" {4 |' M6 l- `$ p$ N1 Nfunction scrollmarquee(){
: u' g4 K2 M3 @! Tif (iedom){
4 R; H: ^& Q. M8 ]5 L7 U1 @! Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% L+ _* d- P. U' H, l- Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, D! J+ c) _4 M( F. i& g" Q0 Y5 D& ~
else
; I. D8 p# L. K! V0 w" P, e. G. Ucross_marquee.style.left=marqueewidth+8
9 Y. s, h$ [3 T8 s% `1 T
& o! V5 S- ~( o/ R}
- k$ Y) E ~6 ~ A( `! u6 Felse if (document.layers){: X8 F* b) F3 S& P5 s
if (ns_marquee.left>(actualwidth*(-1)+8))
& d w O( w) Pns_marquee.left-=copyspeed. O6 |, r5 {* r' c- ^
else# D' C; ^) z2 O4 m% e: A: R
ns_marquee.left=marqueewidth+8
; S ^# l% j C" |+ d}
& ~2 {5 c3 ?- w}. P: f j+ q. y* z% d
! D4 R/ E8 I: y. e. w0 Y
if (iedom||document.layers){3 E' h3 T% k D5 e
with (document){( H3 b3 f( B5 B: @9 w3 Z# O- l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* Y+ O+ v8 T$ V9 E) a' j
if (iedom){9 h+ I! g& _% p2 p5 x7 E! Q) t$ m. l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), |2 ~3 \% q) F) d2 `" r0 q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ s9 R7 A6 ~2 W) Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 [8 y- P* r( M$ a3 W ~4 Q4 _write('</div>')
3 J5 _) T" w# i C) i" @}# [! H* P( N" T* S+ f6 e
else if (document.layers){
8 b* F/ f4 w, j9 _- D! uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 G3 `8 e& @# D+ \) w' n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! u$ T$ A/ r$ ^3 O) X& P0 pwrite('</ilayer>')3 b5 V! r3 Y) P2 \1 w ?
}
8 N. o% I: t% p& tdocument.write('</td></table>')
) k/ C- |/ b4 y: q2 G ]4 L8 Z; z1 U$ g}
* G5 @9 `! @5 U}% ^' v, t& q \( @' x- {
</script> |
|