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

|
网页之跑马灯文字特效
//修改宽度7 u' P/ [9 F* `' Y
var marqueewidth=300( h" w" \. y# `; O4 j
//高度/ b" @$ @0 v1 Z6 C
var marqueeheight=25 J6 A: l- ]) ^7 z5 `+ y3 M
//速度(1-10)
% o8 i! k! l/ h1 jvar marqueespeed=3
! Y W9 I2 L5 L# P- N& F//背景颜色$ _1 e3 @1 P9 G* |. g
var marqueebgcolor="#FFFFFF"
- |4 f6 {, t" m; f//是否能暂停 (0=no. 1=yes)?
( B) f- y& q) L W0 M0 f& avar pauseit=1
, G; @- b( V% ~+ A0 f/ I: [5 R- q1 z& p0 k% G
//修改显示内容
! h" V5 Y; J! T7 T2 n$ m u( _: Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ Z5 B1 ?7 q B' P: [
0 q$ K4 a& d0 N, H- I! O/ h' F, i |* T$ G! |9 c4 Q
////下面不需改变////////////7 c) I2 t9 K& w( q P
& ^* q/ R, x2 a# q5 v' ^2 `" \; zvar copyspeed=marqueespeed8 q. D/ V4 n( Y
var pausespeed=(pauseit==0)? copyspeed: 0 u1 v4 p, h8 R' E: q
var iedom=document.all||document.getElementById
2 j" p7 n9 P. Q, S8 Z+ n# Uif (iedom)* M# E& a0 I+ K) W: _/ B, _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( m# _# }) x2 s$ d% N. Uvar actualwidth=''
( z/ O2 a4 B, n" m2 avar cross_marquee, ns_marquee2 {4 u) H; U& g" G" n
1 d! R' v9 g& [
function populate(){- v6 k v( s& e# K
if (iedom){0 n' g) w5 m* v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 M5 g. e7 @! Z9 w8 Ncross_marquee.style.left=marqueewidth+8
1 N. x, h G! q6 D7 rcross_marquee.innerHTML=marqueecontent
' s! ]# e& _* m9 C7 mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ e- S. j- N/ y: X {) x}
- s$ U- Z$ D) Relse if (document.layers){3 e1 ]6 b7 R! B' t* k$ F
ns_marquee=document.ns_marquee.document.ns_marquee2
0 S/ _) t$ a/ k `. ] Lns_marquee.left=marqueewidth+83 ^) r+ y; N% X0 W- ^( @1 u
ns_marquee.document.write(marqueecontent)
^' M5 ^# _& @. A) Y$ D4 W0 Nns_marquee.document.close()
. ~1 f0 m& m( L5 s% F" w1 m0 Uactualwidth=ns_marquee.document.width
1 B* v6 o) C" a& O}9 O* R" m5 q) @: |. t9 R6 ~
lefttime=setInterval("scrollmarquee()",20)
9 L1 X7 Y$ x O8 W% z} d7 d. R* T* I- L& q8 r
window.onload=populate
% F% i. x y5 D g+ j" ^* s& ?/ }
) X8 c3 {3 W; h9 y/ pfunction scrollmarquee(){
: y7 t- j |* _4 ?if (iedom){0 X, j% l. T( B( C* I: |3 i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 h* ?0 W* x! q7 ~% \6 ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) i. I/ k; w |' u belse: I8 V f/ ]" {7 ]; V
cross_marquee.style.left=marqueewidth+8
4 f; h [) B" A& |0 X' g* W$ J1 s l4 n# |: B$ m, W7 Y
}
) c$ M- z7 [' c0 O# O- x9 K% @else if (document.layers){
# b8 u1 I( P2 M+ r( oif (ns_marquee.left>(actualwidth*(-1)+8))0 |+ L( s9 X- ?/ C. B: ]6 p
ns_marquee.left-=copyspeed2 Z, t- P s0 b" N9 l/ M( F
else w! b1 i- q# Z9 X
ns_marquee.left=marqueewidth+8 X. Y0 G8 X1 N1 l6 d
}, H( {) r/ M* ^6 R& H( J/ X
}
! d: S4 l. e. C
9 r7 X; I8 n# N2 t2 e3 qif (iedom||document.layers){- f- V2 p+ I7 L ~2 ^& W
with (document){
* f/ r$ E/ A& m0 p& }# mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) N) F, B& a9 e
if (iedom){
4 u! w* p8 o3 E- {2 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). V Z8 [: E2 M9 Y9 Z! @
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* U& F. W" T: Z3 K; \5 ]4 q* ^, o" jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 q( b* J3 x$ M: O8 o1 swrite('</div>')6 _/ c: x; d6 M+ `7 L' _3 E
}
# v" F+ r: t3 E- B; N- g" {else if (document.layers){
" C( J: x* {; g+ n ]! M3 q' M' Q8 T& H- Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' L3 `8 s& R; B, H5 H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') B4 s. a( X/ i4 J& ^& z8 T0 b3 H3 V$ ~
write('</ilayer>')
! k& V: @! {1 t/ O}4 ] \6 g/ r" T$ q
document.write('</td></table>')8 M+ x# a( H8 r/ b6 F! z) q' o9 y+ T
}
~8 |' {( d1 B}# f e z$ y2 E3 {( w; \: l
</script> |
|