返回列表 发帖

网页之跑马灯文字特效

//修改宽度) P5 ?2 H/ R7 ]9 ]* C& z& w  U4 T
var marqueewidth=300
. s3 t/ ~+ e2 H* G//高度* m; L, m7 {; f# M. E! Y
var marqueeheight=25. i2 w6 L- m& M0 u/ E6 \
//速度(1-10)% G2 n8 o, \# N% A  g5 r' d
var marqueespeed=3
# C8 b% V, a: ~% K$ ]//背景颜色
) q  h2 ^! E* H4 b% M; Pvar marqueebgcolor="#FFFFFF"
/ A# D4 I( R$ U! u5 V5 m  v; R, u1 M1 H//是否能暂停 (0=no. 1=yes)?$ M# }" k: Q9 V  o: _0 h9 }
var pauseit=1
$ k  X- D( N) I( @. R7 `  x' V; Y0 q# Y8 S# g
//修改显示内容
: u1 M* f7 ]6 J$ d5 I/ n; Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 r/ {5 }3 w" Y2 x- r% L
+ [* \% r7 z7 X3 o8 b0 ]& p( H* m5 p1 z; O2 t8 g* v4 X
////下面不需改变////////////
- k0 L6 ]# I) p# @
9 c/ F' O6 r7 Q# ?) t0 G$ cvar copyspeed=marqueespeed" k5 k. X" L+ K; {  p) {; P
var pausespeed=(pauseit==0)? copyspeed: 0: D: Y" a8 R. a( }# j1 o- k
var iedom=document.all||document.getElementById; [9 F7 J( H8 Q: Q$ f5 ]1 w
if (iedom)
& a9 |; E6 M3 ?8 f, ~) qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& X! c  X# d& F6 `* n  ?  c6 Nvar actualwidth=''6 V1 `% @+ ]  \$ @
var cross_marquee, ns_marquee$ [3 W6 ?+ G$ z8 D$ B+ l: C
. M2 o' `* _: f0 M" D' g
function populate(){
- S$ `1 o9 S) q& U) gif (iedom){
5 a7 P* D9 J: l; Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- H. f6 ]3 o. `$ Gcross_marquee.style.left=marqueewidth+8# g4 o" q& q0 K8 W& l
cross_marquee.innerHTML=marqueecontent* L4 t7 s4 @+ z5 X: k; D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  b, J  S: s7 a( i
}/ y! C/ D1 {( [7 r$ x
else if (document.layers){: O  {2 y" H% k/ y( j
ns_marquee=document.ns_marquee.document.ns_marquee29 ^& F7 k1 V0 I  {; }  R& J
ns_marquee.left=marqueewidth+8% z8 Q' a3 F4 l
ns_marquee.document.write(marqueecontent)
. z. L. B& M8 ~/ qns_marquee.document.close()
  B/ z* D# ]( X/ R3 wactualwidth=ns_marquee.document.width' Y5 {( k' O3 {1 D* a
}4 p& w+ c( i3 ?8 f% c7 ?
lefttime=setInterval("scrollmarquee()",20)
  ~& U$ p% y: Y2 a3 M}
, o* }" z+ M* q& Pwindow.onload=populate
3 L) r  G3 L+ \: a$ \" o+ E4 {2 f4 s0 N, e
function scrollmarquee(){' T, r, S" S/ n- `1 @: ]
if (iedom){
& \& r3 _% T/ |$ L3 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% ~& O9 k3 F: {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 D. D9 q3 |+ h; n5 n. b2 Kelse0 d' ?- o5 [7 {. z% ~$ c5 `2 @
cross_marquee.style.left=marqueewidth+8
5 u4 s% \6 e3 z6 E) T% {7 Z/ z7 d" j$ R' W
}
: ~9 Y+ I& L$ j% Celse if (document.layers){  P* ~( ]; f2 [, T
if (ns_marquee.left>(actualwidth*(-1)+8))+ [7 e  Z5 u1 u# V5 j; s7 @6 w
ns_marquee.left-=copyspeed2 c* |1 G8 _0 j+ r4 Z" m7 ~: U% c
else$ ^6 s0 h4 P+ r# t" g
ns_marquee.left=marqueewidth+8! H2 s0 [) u- O1 D( h  R  n
}
& z9 N) U$ Q+ H3 K5 |! y' K2 |) l; S}
7 f# \5 I5 w) I2 G/ Y8 j0 R- J3 b* @
if (iedom||document.layers){! l, ?! E. S; v7 I: \! f/ @
with (document){4 F* [$ [" L6 Q& b6 E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; L+ d7 D4 n! c9 p4 \if (iedom){
8 }- Z( q3 U$ N. l/ s) Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ r. P% O8 u0 G- T4 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( F. K5 ]0 Q" m! C5 N/ |9 u
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 W' ]$ G( M. w8 \  k
write('</div>')
. t1 a# F; ^. L}
$ o' Y6 o% E+ Zelse if (document.layers){% ]" q4 Z) H6 Y4 E  \% ^4 J) i0 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 M( l% p( y& j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& U/ K9 P8 v/ p8 \: z7 [$ u" c
write('</ilayer>')
$ }1 z" A+ j) Q9 H; n2 @( \}3 |9 |" U1 R! x: x
document.write('</td></table>')
% t; z& {' }7 {! n/ b4 \8 G}
8 M# J9 p. z$ Z0 v( h* a' C. Z) I}
' e+ K" q- k6 H" y; K% H& s7 j</script>

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