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

|
网页之跑马灯文字特效
//修改宽度3 D% o: m. G- [9 ^* H* X1 x
var marqueewidth=300
9 I% J2 E4 h+ h/ }4 s//高度' F% H; N4 \: J! j& Y
var marqueeheight=253 i! ^: M& _" `, z3 ~! s5 H$ Z
//速度(1-10)* y+ u% D; z6 h2 s0 J7 G
var marqueespeed=3
$ Y( f) H4 ~9 Y2 Y/ U% |//背景颜色9 r: f% v3 a4 ^1 W6 {' Y
var marqueebgcolor="#FFFFFF"( A" t6 d9 } ^
//是否能暂停 (0=no. 1=yes)?
+ O4 U) L! x w$ g) v4 Tvar pauseit=15 a# m& |) n, j3 ~ w C
! b/ G! X$ h- \8 D//修改显示内容/ q5 d' ?6 k0 G, E* v# @& t) l( j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# U: {6 J, Z1 F
5 C5 B- b* K1 m2 i) `9 N! ~
: [- k K6 L) }" n
////下面不需改变////////////) x" p. t' E% z& e
1 C2 |: u+ b7 p$ L, C
var copyspeed=marqueespeed @. @ M" P) L8 d
var pausespeed=(pauseit==0)? copyspeed: 0 x# \ \8 x' S7 V% i t3 a; S# n }
var iedom=document.all||document.getElementById
: ~( ]7 }- [: @5 K+ z2 [ ]if (iedom)0 b' y) |# v' B. n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; @2 h* s% W% ^( P9 O2 _' _0 evar actualwidth=''
) g2 a; ^* z& v# \var cross_marquee, ns_marquee' D# u, y; A6 d2 ^9 ^0 J$ Q& O3 O
2 L6 W) s* f8 `& c. Dfunction populate(){
( i- n5 Q5 F- T' ~$ O% Fif (iedom){' Q" a+ p" ]+ n; ~+ s
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, I( i4 ^& B$ s4 hcross_marquee.style.left=marqueewidth+8! h ~0 _/ D6 h \
cross_marquee.innerHTML=marqueecontent
8 r: u; Z6 [9 }1 K/ @( Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 A: }4 ~ p8 i# i. F% o
}
4 Z M. S5 w9 Q% c/ I* A, ?0 ielse if (document.layers){
: Q' P1 M$ v) d8 \. Kns_marquee=document.ns_marquee.document.ns_marquee2# e1 G6 ]' V6 E7 g% L. X. K
ns_marquee.left=marqueewidth+8. `9 \- C$ X. q8 T; l
ns_marquee.document.write(marqueecontent)
9 C8 ~- I4 @7 Y2 sns_marquee.document.close()
% X- B" A0 E" C" K$ {6 X% x& Jactualwidth=ns_marquee.document.width3 ]6 L0 m3 e0 x. E, ?6 I
}- C1 b% K `3 \4 b# _* D. q. `
lefttime=setInterval("scrollmarquee()",20)
5 y7 Q+ s4 l1 L, W}
2 ?0 D9 W/ |( o E( }/ ~window.onload=populate$ P3 s. ~5 v" g9 o. [
3 m" \6 f$ t0 R$ C# [6 g$ z
function scrollmarquee(){
; y. `4 L& k5 R1 ?$ sif (iedom){5 U! I- R( x3 s# `+ z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 X2 F8 ^' Y3 {) `* {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: r5 ]. p( Q9 c' ?( i/ p' d; Kelse& p, q2 B: G7 o2 z" k
cross_marquee.style.left=marqueewidth+8
5 H( r3 ^/ z2 K/ S
2 r3 K8 v6 n0 o# I}1 x1 b7 ~) K8 k! k7 i V
else if (document.layers){
3 C& t. _+ D6 ]: s& Pif (ns_marquee.left>(actualwidth*(-1)+8))
1 ~. u% E# T+ t* E) Mns_marquee.left-=copyspeed8 X1 W1 y( c& {; g( M
else X) Q1 Y" L. Z% Z7 _- G6 ~# s
ns_marquee.left=marqueewidth+8. E) @ C. b: L7 J, T, `* N: ^ r
}
4 w6 x9 _. `$ w* a( o( f}
4 R' a9 @ Y. Q/ B$ l* @" l) J3 g( @9 D p1 {
if (iedom||document.layers){7 p, C# w- m9 k7 i- r
with (document){
; B- j0 X* y/ A% @" K9 p+ H4 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" F! A, i2 _3 y! H+ E
if (iedom){; M: S A5 {4 d( n, U* Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 w& a* J' F; \0 ~4 u2 r. Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, u8 A5 t4 w6 W; B, jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* b' S/ e4 O9 f0 T( X1 i* C3 r
write('</div>')
' B$ U: a. E5 R8 W& {& _}* H& I5 _* m; }+ ^# I9 D
else if (document.layers){
7 F z' L; A& w, S. o+ z" Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% y1 e% {& k7 p$ Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" l/ n6 q6 k- gwrite('</ilayer>')' |- B; c2 e8 `4 a: @! t8 k6 ^
}% v- i/ N4 n# ]# p$ F% f
document.write('</td></table>')1 z) R% v! u" Y/ w
}
3 V. L _4 ?- d' Q/ @+ c t}
- w( U7 h8 Q% @" d3 X9 r: ]1 @</script> |
|