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

|
网页之跑马灯文字特效
//修改宽度
/ c: e$ k8 u8 A4 P! L! A9 v! M+ N/ P* Nvar marqueewidth=300
' l# c1 P' Y5 b( W A) N/ q//高度
$ B& i3 n4 D; C0 ^7 Uvar marqueeheight=25
. r3 }* T" j) K//速度(1-10)' u2 ^4 @5 ~' X1 z' m) |5 Y
var marqueespeed=3
3 o; B& T1 G( }; P//背景颜色6 o+ v- M, f1 j& v, y4 ~0 J' D
var marqueebgcolor="#FFFFFF". w! K: K8 a- n# Y5 E
//是否能暂停 (0=no. 1=yes)?
+ h+ v% H5 E# v( H; Fvar pauseit=1! W% S( t4 V* v" h! B% `
8 W7 @1 w! q: q- E! d( e//修改显示内容) P' F+ R" i. h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 q% u+ V" T3 C+ d8 Z) @2 m8 i9 Q- j3 |, H( s, |# M
5 l& o: g, h% G0 \8 Y8 ^0 F; W1 g
////下面不需改变////////////
# T! \6 Z/ N; i- T8 y7 H
" r3 _ X ~0 D# W8 tvar copyspeed=marqueespeed
+ D. R/ w- f! I: n2 r; ^var pausespeed=(pauseit==0)? copyspeed: 08 G% J; c8 N5 m2 c
var iedom=document.all||document.getElementById
8 O. f# `- J0 _, L6 _if (iedom)2 R3 U# N a" {5 j! A% D8 Y8 q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ z; x, t+ C) f g( p, qvar actualwidth=''
+ n$ U0 R* [( l0 X5 O# n, Ovar cross_marquee, ns_marquee
# q4 b8 @- G; X" y4 {
; J+ G. f) j- Z8 p7 Efunction populate(){
9 X; [+ |' ^5 U( v( {if (iedom){4 \7 L, ]" u9 t
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 ^: o) [( a* ]+ c2 t7 r8 Kcross_marquee.style.left=marqueewidth+8
; g) i% U# O- U7 U$ m) T" d& A- rcross_marquee.innerHTML=marqueecontent, O# z- N# ]# [* ]" H% ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) i3 r+ _& M8 I0 R
}1 p) c/ j$ X7 J
else if (document.layers){
@4 h# R, M3 q& \! m7 |$ _ns_marquee=document.ns_marquee.document.ns_marquee2
7 b( C8 f5 L3 n: z9 W0 ?ns_marquee.left=marqueewidth+8
P" s! b B( a) n9 V$ A! S% vns_marquee.document.write(marqueecontent)
& W& n1 `7 v0 y5 w/ w3 x" S0 mns_marquee.document.close()* ?2 O6 ^; T# A6 W! Z! S
actualwidth=ns_marquee.document.width% Q8 ]. t0 n1 m) x b+ h
}
. e ]$ q) _) _ F9 b, G# qlefttime=setInterval("scrollmarquee()",20)
& B5 ~, I. [( }4 p1 G% R: s}* c2 Q8 v' o1 q1 T7 a7 n" w
window.onload=populate
/ Q% V1 E/ x0 ]+ G+ x) B0 M" F- D0 b3 D5 b
function scrollmarquee(){* {( {4 [. |- t: K/ t& e
if (iedom){
4 z4 U" b# n9 f/ Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 ]$ x- y( q: l, ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 s6 B# ?8 ]. u/ v; z/ y
else
( |" Y9 X5 t5 @4 e, mcross_marquee.style.left=marqueewidth+8
+ E5 v. t s) n9 q' i* z( f+ Z* e! `( H; L$ l/ ?
}/ {. ?- ]6 }# ~! W7 x0 H/ @
else if (document.layers){
) ?- x$ l! y" C! ?+ K5 |if (ns_marquee.left>(actualwidth*(-1)+8))
. Q# O3 l3 X' o5 R" ^& L* {; [ns_marquee.left-=copyspeed
" S3 m q/ i0 N" T welse1 C2 y. d' L# Z* F1 {6 ]
ns_marquee.left=marqueewidth+8
* v3 W. ]* l. u. \& Q& J% e. x* x3 ?7 S}0 ^; p3 q& Q( Q! q
}2 b& y X3 @: R8 h5 e
$ |- U/ X! G; S, ~
if (iedom||document.layers){# M1 N5 c2 J4 u @' S
with (document){
) i9 G9 X7 O7 m- wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& }4 @! H- x, H& @; @8 p
if (iedom){) d* o8 j- g c7 _! |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# X2 ^ E/ k; Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& F: ^* s! J$ U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 f- J' e/ Y4 I8 F. L5 uwrite('</div>')5 [. p& q0 I, Y$ ]* Y8 w Z
}
" [! N) _$ ]" T) U# c4 Nelse if (document.layers){ n0 n5 f) x0 S' ?3 d, |( d0 v D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 w% Q- ~, Y# {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 I0 ?# F- |1 _
write('</ilayer>')3 {* f/ d3 ^! a9 m1 `
}2 l# V. r- _8 O* q7 |9 h7 K
document.write('</td></table>'); C6 O7 Z4 O7 ]" o8 {$ w# O! s
}* v: J/ L, P/ @8 p7 t& u
}
7 q' P$ a( t5 K: ]( a# o! L# p</script> |
|