返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 V7 ]. n( n" G: d. C! C
var marqueewidth=300
, ?5 z8 A6 g' b4 `//高度
4 V0 m( |9 [1 k/ _7 ~4 J" Ovar marqueeheight=25
# y9 p; i0 D; a; \3 j4 a0 k, g* e//速度(1-10)
( @- U$ {+ G* }: u2 s0 [var marqueespeed=3) C" [7 i+ p' a6 D9 y
//背景颜色, r: I+ x1 j6 g) o# P/ d0 b' V( M
var marqueebgcolor="#FFFFFF"& b# c1 U* y4 s* U; x; |- [% H
//是否能暂停 (0=no. 1=yes)?6 P8 v2 y* ?- |8 S" l* B" Z
var pauseit=1
6 a+ y& D! Y! G$ ~; {
* o, V( x4 J2 I2 H; [! @' \! J//修改显示内容
; U9 v& X6 M- ^) e" F  O8 e* xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# E4 }/ [# |3 M7 T
) h4 g" w& D+ J2 Q* W

' H6 g5 N  H- T. I& l////下面不需改变////////////
7 @1 T9 J, q/ W, X# S2 T4 L+ h5 z5 D9 C& ?
var copyspeed=marqueespeed; C: C  P, k' T0 S$ f0 p6 V
var pausespeed=(pauseit==0)? copyspeed: 0
. l9 Z8 q! k% ]  [, F3 Ivar iedom=document.all||document.getElementById
) O, K/ C  k4 d( W- W1 A# \if (iedom)
0 S/ T7 u; X: g, c2 }: Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- G3 A. W! |/ n' hvar actualwidth=''
& Q( f2 ~& n  ~, [, Gvar cross_marquee, ns_marquee
. r5 R4 p/ X$ n6 z  V1 {8 K! G( T  s
function populate(){1 r" S2 f9 u; g1 }# t5 ]
if (iedom){
  E$ ~8 n7 F9 F7 ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 [  B; U1 }; ~5 r1 i3 c
cross_marquee.style.left=marqueewidth+8. q+ P6 S) S# T6 l- d$ g
cross_marquee.innerHTML=marqueecontent
! P$ P5 q- p( Q% X) xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" U5 {2 i8 `3 O: _# d
}
# z: G( H9 X) ^' v* v3 a# w$ k4 Welse if (document.layers){  K# K  }4 C9 X  d9 w- u
ns_marquee=document.ns_marquee.document.ns_marquee2
: i: d3 Q. t- T; _ns_marquee.left=marqueewidth+82 G" F$ g7 u5 B# t+ H- i
ns_marquee.document.write(marqueecontent)
" E5 O) B7 E! b) ^+ G" Qns_marquee.document.close()+ L5 B# E( }* |8 L! ?: e
actualwidth=ns_marquee.document.width
3 W2 ?3 ~5 v& v- |" o0 S}2 q& [/ R( ], L6 ?( a# {
lefttime=setInterval("scrollmarquee()",20), G9 |3 o0 O7 B+ a
}. w' X6 D( P" C9 B* V1 X- ?/ h) L; I
window.onload=populate" a6 `1 j* K) Y  Z

$ W8 B3 a8 ~+ S9 vfunction scrollmarquee(){
$ I9 L1 K. ^, Y3 oif (iedom){
$ B: d& [. a. o% o% qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& K5 c& c& h/ ~4 J, V7 |4 y+ Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 ?" ?" h! \$ i" G, C$ C1 Kelse5 I% G7 Y0 x: G. C
cross_marquee.style.left=marqueewidth+8/ u% ^8 h3 A  d

5 x9 [9 O. ^$ W}/ P( t6 S& \* Y; h* y
else if (document.layers){
0 C3 C; q, Q5 l  k8 I0 Iif (ns_marquee.left>(actualwidth*(-1)+8))3 m- L2 L, j: y5 X" {5 r3 R
ns_marquee.left-=copyspeed, n7 ^* P6 Q0 _/ {' y: E
else! E5 ^0 A6 F' G6 ?1 D5 \8 r& I
ns_marquee.left=marqueewidth+8
' v4 }- J% A5 L" l( k; T' c+ l" y}
* K' F6 q# `" [+ K7 l4 L8 x" ?7 [}9 {$ D1 S% K! m$ N5 w6 R: d& x

8 h# U: n5 ^. f' L8 a& \# Vif (iedom||document.layers){
6 ?/ P$ S/ O- N4 D% x/ G( |' Cwith (document){+ Q$ u9 i& {+ X8 S1 v" X; N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 n8 ]! [! G+ T0 b) g: Hif (iedom){
' Q* z5 V3 m; r: Y: rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) i. K  G4 G0 E2 g7 u6 g& Y. N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ f/ X% f! x) ~8 ^. g1 ]% L2 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 g4 ]( K' r( `9 K9 \5 K4 qwrite('</div>')2 K3 v+ Q) O" g2 t
}
# u/ o" P1 ~# k3 C5 l2 U: \else if (document.layers){
0 h% ~6 k: S" _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' ~) }( A- I8 k. `* `: m( uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  ~. `) }& u- _- J/ O$ o( o: Dwrite('</ilayer>')) Y6 s; ]/ H, E8 C
}! X3 Z9 v4 P( P3 {  n/ e; ]
document.write('</td></table>')8 [) J. M9 @' a9 X  L- l( V0 m
}* D! ]8 X+ ~5 c4 x
}
7 ~# L/ f1 o* \) d& t</script>

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