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

|
网页之跑马灯文字特效
//修改宽度2 T& Q: _- T" A( Q/ ^" Z
var marqueewidth=300, x7 a. j1 s( U3 Y! i
//高度3 e) R& y) I& Z* P$ b5 f. B
var marqueeheight=257 c" y m; t' k/ e9 j
//速度(1-10)
9 d" c1 I, C' V: Z! w5 p9 o1 W5 L/ Pvar marqueespeed=3+ u/ i3 P' [8 W, Z, Z
//背景颜色
, D; j/ U. s5 z% l; [var marqueebgcolor="#FFFFFF"
# x( b6 @- G1 c x0 _; [) [//是否能暂停 (0=no. 1=yes)?
1 m4 i- g& h, [+ K* zvar pauseit=1( S* s6 B' e4 ]. F. c+ G
$ y1 H1 u0 j3 x h5 w; `
//修改显示内容! D: U4 V0 {. J$ r6 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ x8 C6 k( k+ x, {
5 x6 j1 l6 @" k5 v9 q/ b7 ^' N! {6 q: g( V2 O
////下面不需改变////////////7 C; Z0 _- w; ]& \. r) Y9 x
2 K& r6 I1 y" N, b1 mvar copyspeed=marqueespeed- _* O, ?: F( h0 `) ?8 R+ N4 h
var pausespeed=(pauseit==0)? copyspeed: 0
" \8 ?! f+ G& y/ {+ ?9 zvar iedom=document.all||document.getElementById; D) n1 n5 x( l) F. U
if (iedom)
* P2 z R9 p2 `6 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: e% v9 Q3 t8 o8 Yvar actualwidth=''
) i8 u$ K1 Y& }1 U5 u. evar cross_marquee, ns_marquee
' e* T/ T D# u
$ I9 A- N5 d4 r0 h6 [: }( ffunction populate(){
( Q# t7 s& i6 L1 Q. Fif (iedom){2 A9 `( N# f' c9 R2 i, [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ h; I0 j1 w- X' q' y; J, y1 m# Vcross_marquee.style.left=marqueewidth+86 D: n: N/ b& s7 ]
cross_marquee.innerHTML=marqueecontent
) b1 i. W* s1 D9 t4 c Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# f: _8 ^& Q+ D0 b* C+ F2 y
}) _; z( u/ J9 q3 {) b. c
else if (document.layers){' _0 Q% o: J8 V+ N
ns_marquee=document.ns_marquee.document.ns_marquee2
3 _$ ]% ] j8 S! Z/ f! zns_marquee.left=marqueewidth+8- W* j8 _: x) R5 B! R+ |
ns_marquee.document.write(marqueecontent) m% D" Q, p: j5 U3 ^0 f3 ^$ ?5 a
ns_marquee.document.close(), R/ s/ |: m: w! M* I
actualwidth=ns_marquee.document.width
1 K9 D# P3 U% m2 t# s$ ]! B}/ x1 [, @% W) n/ i3 A
lefttime=setInterval("scrollmarquee()",20)# [# s0 c* n: s v8 F9 V: s) x
}- J' @' `: L* X+ B4 ^3 _+ V' n
window.onload=populate* d0 g4 `( S8 q
0 B! R7 ^% {. @& }3 y4 n: d! xfunction scrollmarquee(){3 f% f( |3 U x( H* V
if (iedom){/ X3 \# F0 {" a' h4 I1 G% E2 `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* J% t4 C6 W1 ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) u7 V' k: k+ ^$ G5 O! \else
* B4 V2 U+ `( c! c$ `2 n" _ Ocross_marquee.style.left=marqueewidth+8
7 j5 H+ c2 a" N/ A4 z; q, w2 e, `$ P1 Z# c+ z. V/ W" b8 s! b
}
: _4 j) w9 E0 q8 r+ q0 y. velse if (document.layers){/ s; G% e' E' o2 f6 o
if (ns_marquee.left>(actualwidth*(-1)+8))/ {( |. T# l9 [9 V) t) t \, Y
ns_marquee.left-=copyspeed
; S. B8 c" g; r8 O% welse
5 i1 N9 ~, |7 V9 n, h& |ns_marquee.left=marqueewidth+80 k' ?; a3 s1 s: v" V
}
4 \6 W8 \1 F& R4 a6 P}
% [) S; G' x% D+ k
& ~, U2 i' j) T5 b/ p# Sif (iedom||document.layers){% m( T9 A5 E& U# o7 a
with (document){
# T; f. B' {5 n& E6 E/ Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) G; E: s# o" J) `7 X8 v2 aif (iedom){
4 \% |5 l! h8 W& g$ g# Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 w D+ x* H+ d- L6 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ m {. [- [- c3 E" O: T |9 A' ^5 S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 z# b0 [ x: {& m' m6 j
write('</div>')
$ q7 H% X( z% V: z3 T6 M; a}! q2 [' H* [- f7 K5 y/ o
else if (document.layers){4 C: e1 {# n8 ~+ {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ E% D4 b% L/ R& N7 I, G" Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ w. t W, ?& \9 r# H
write('</ilayer>')
. D, Z- n7 {/ O+ J}
: e+ z& P7 b$ n0 P/ c( ]2 {) qdocument.write('</td></table>')
; o3 S7 h4 x2 w3 q}+ z! I$ ?; M: {( \) r
}. y3 n# @& p9 i1 x+ q
</script> |
|