返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- K/ d7 {  u5 Vvar marqueewidth=300
" h/ @: ^2 w; I; T//高度; T  ~- q8 P# [5 T; j3 P
var marqueeheight=25
4 f3 B5 _9 A+ e& K9 ^//速度(1-10)2 A5 t: e, x0 b
var marqueespeed=3
5 [, t& e' [& [. {2 A$ T. C//背景颜色
0 T6 e8 \& A7 {4 O( F/ dvar marqueebgcolor="#FFFFFF"
" w6 Z% ~6 o% }5 B! _9 I, W% t' \//是否能暂停 (0=no. 1=yes)?
' i( o/ S: n1 Rvar pauseit=1
6 g+ B% x8 M5 @! W9 W
9 _0 }( }- O6 v( s& n' x8 m8 J//修改显示内容9 v- O) B1 Q3 w& }' w: y% w6 d# {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ e* z# P2 L( [- z4 L% |
( d8 t! @0 `! J7 l4 H0 R3 z2 K' E" j: z$ [: d4 c
////下面不需改变////////////
/ V/ j* R- j, R( v+ e. G% Y" J- R3 b$ N
var copyspeed=marqueespeed9 V& a( X/ v+ l1 o: S
var pausespeed=(pauseit==0)? copyspeed: 0
1 g5 G) l) i8 S5 K8 X4 O' k6 cvar iedom=document.all||document.getElementById
0 r& _1 g6 |. q- J) dif (iedom)* Z. E  n* X% Q: s; E( V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ q& B& e2 o' q& l$ M
var actualwidth=''
$ J* Q7 R: \3 X' Mvar cross_marquee, ns_marquee
. z9 A  X* e) Q
7 U* _) I0 g# Y* P% F- O. Ifunction populate(){
. m4 c* T+ Z7 H/ ], C: C/ Cif (iedom){+ K. \2 O4 h  Q; g# H5 f) E  S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 G2 x& k" E# S$ l3 O2 R
cross_marquee.style.left=marqueewidth+8- R' \; B" w6 O/ ]4 P1 d/ {
cross_marquee.innerHTML=marqueecontent
8 b( \! a  W/ d# w* Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 H6 Q. W3 r+ F+ ~  b6 I}
. E/ v: Q0 z. a4 k0 h0 Jelse if (document.layers){# z5 y& [& J: Z* u
ns_marquee=document.ns_marquee.document.ns_marquee2( U, R& c+ U% v6 f9 g; C6 _
ns_marquee.left=marqueewidth+8
" \: G3 K, t5 {ns_marquee.document.write(marqueecontent)
. {9 v' G4 N9 n1 dns_marquee.document.close()0 Y! {6 u0 c3 y! n3 h% C- ~# s
actualwidth=ns_marquee.document.width9 m: C+ F5 I% ~* c) Q
}
2 @6 C" u, \2 v+ V' klefttime=setInterval("scrollmarquee()",20)+ V& m7 M* V0 |) \, S
}9 _( I2 K$ ?  O9 |, M: q
window.onload=populate' w5 z5 ]2 {8 z5 n- W" z$ _

* w3 x. I6 @. b0 y3 N4 kfunction scrollmarquee(){
1 [  M) e5 _4 U6 Y6 w5 H- Nif (iedom){
! T( \$ o. y) x/ ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); b0 ?. ^+ r3 i+ d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, |! k9 @- @' L  O" Qelse) ~4 P/ \& c' F) m8 g* k
cross_marquee.style.left=marqueewidth+8
9 q; m2 w7 L' |4 R  W# b  x! |" N2 |4 T( D+ |! t3 C
}
7 w1 |4 ]# ~' |( M9 X: M7 Aelse if (document.layers){; N+ j* X; ], T) m
if (ns_marquee.left>(actualwidth*(-1)+8))
1 s: x1 s! V6 F3 h4 F& k9 ?ns_marquee.left-=copyspeed& J+ l$ D6 s. O+ a
else
5 W& T8 l3 C" l/ Y2 P* a" q9 [! Q2 cns_marquee.left=marqueewidth+82 f# S; J% R, s6 l9 ?" i, E
}
' u$ u/ A3 ~1 s4 j+ m}
! r7 \' i# K2 V, b, b  F
% e  U% ^, l# b8 ^) zif (iedom||document.layers){
0 I) F8 @% b8 K5 `& d2 p4 D3 Jwith (document){
% r0 D1 f+ @1 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 J' Q7 H: ~, g/ Q; N
if (iedom){; A$ d. A, e: L) G% y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 j3 E, H0 t7 {5 U  q8 ^& P/ m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 E" M* s& {* y7 n) X. Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 i0 O" F- Y  {3 S  f3 \7 ^write('</div>')
' e- ^: v2 j; v0 q2 g, f}% x/ S7 W$ d1 L4 ~; P: _- W
else if (document.layers){! a6 w( ]; e5 v8 P8 a
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. ]: U% e# ~- p2 E* |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% C& C3 b# }! N; Lwrite('</ilayer>')" y8 R  C( l6 W$ B1 e6 L8 [
}. u# t) |) m5 o) M; k
document.write('</td></table>')
% i1 ]3 J* O+ O+ A+ o8 F  f7 B}
4 N! U: ?* [9 m/ m1 {+ Q}6 @: f8 b% r" i( ]. G; p$ _8 ^9 V
</script>

返回列表
【捌玖网络】已经运行: