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

|
网页之跑马灯文字特效
//修改宽度3 F I2 M+ K- S# `
var marqueewidth=300% J% Q6 X8 M: _3 ^
//高度
6 }' b# [ \, ~6 S" lvar marqueeheight=25% A+ P4 m2 D2 w6 T% f
//速度(1-10)
, l; v9 B$ b; f: w, M: h% g8 kvar marqueespeed=3
& G' H$ `) A- @//背景颜色
- J% J% Z1 z8 a$ Bvar marqueebgcolor="#FFFFFF"
# S5 m- n7 }* a$ {- v//是否能暂停 (0=no. 1=yes)?
4 {3 d$ a9 q4 ~& q" D; Mvar pauseit=16 i# i9 n" U) m( [4 [ G
. f8 F2 |1 u/ C# k c
//修改显示内容
3 b* ~/ j: n2 @3 J! b: Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 x- t# N0 L# j! _& o
8 @6 ?6 {* W; t5 b6 [
0 N5 ^1 D) T& A4 ~) q+ T2 y////下面不需改变////////////
* T/ g& F$ b2 ^8 H4 D
2 J/ H" x/ \, I9 d% Rvar copyspeed=marqueespeed
9 P3 P+ _* ?0 b5 jvar pausespeed=(pauseit==0)? copyspeed: 0
- _4 h- x# K/ A& n* dvar iedom=document.all||document.getElementById
$ |6 X6 N/ q j; iif (iedom)! P) M8 g" ~5 T) X' C; \3 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 H, n' V" F% V. j
var actualwidth=''. U9 b( V( x( K- X \: V9 r% H
var cross_marquee, ns_marquee
/ f$ B' F) X. E) v: @6 b0 a, m+ [4 _( [
4 V- [* M4 t1 w: @* Qfunction populate(){6 B& A5 E3 k5 y0 _1 _
if (iedom){( M; F: Z# [' R6 [4 j2 {: F- j& D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 k, S4 f: ~9 \
cross_marquee.style.left=marqueewidth+8: g# ~! q' C# ?0 L. r3 X2 h
cross_marquee.innerHTML=marqueecontent
; J- }( }# d0 n- ]" o. [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 c% K, t( B5 f/ _# ~
}
. G- S3 R6 t2 n& h) r2 R4 Xelse if (document.layers){
6 v& z/ T, j6 p. O6 l% sns_marquee=document.ns_marquee.document.ns_marquee2# F5 v0 e; m2 {$ f& ~: C, U
ns_marquee.left=marqueewidth+8# u/ h) C) X2 s4 G! M, _
ns_marquee.document.write(marqueecontent)( G9 |3 Y1 J" i1 D
ns_marquee.document.close()0 A9 K1 r( l7 t) {
actualwidth=ns_marquee.document.width+ i G# {) f) \- K( @0 ^
}/ K5 k5 U% j1 ]: b/ [ L
lefttime=setInterval("scrollmarquee()",20), @( E ^& |/ j8 A" M0 q7 y
}
/ b7 n4 G. X5 e9 Z4 _( pwindow.onload=populate7 g8 n2 Z2 H3 G% r$ l+ [/ b+ I
( L: n1 d! H+ e% ~& Z0 l
function scrollmarquee(){
+ x& o! I, F2 {; }" Zif (iedom){& ]7 A) k$ X9 ~6 |. c( x5 @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. C. d, o; T% P# @% n7 P* T7 @8 [/ V( ?cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# `% S8 b" ]0 a. C& M9 v' telse
1 ^/ \8 ] T: e- H! g) Scross_marquee.style.left=marqueewidth+8/ `, N0 R" P9 I7 W9 O+ F
' }! {; Y9 C; z+ }# w& x
}
9 X0 `1 L# {. W g, j# felse if (document.layers){9 d9 X% Y2 g# X$ b( c6 J7 T
if (ns_marquee.left>(actualwidth*(-1)+8))
& W5 @3 l2 f+ e9 w T9 Hns_marquee.left-=copyspeed
; Q- f0 ~5 P% f+ j) x, K' k, |else
3 B2 E$ _, H; j) B' A: }ns_marquee.left=marqueewidth+8
7 S; U% K7 p1 A: p$ @9 l' [/ W _}; n y2 ?( @* D9 D. m
}
5 U2 f: p6 m) v3 ^+ _+ u; S; }# O( v$ v$ n+ D
if (iedom||document.layers){/ G: ^3 S( W& V; ~. G6 c
with (document){ O6 s' |. P i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') ?1 D$ E+ c, k/ F( W4 k4 P6 e8 D
if (iedom){
" Q; J7 z" }; ^8 q3 b0 j+ {# vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 c$ B( R2 ]4 i3 R4 ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 q3 T9 e2 ]9 y+ p( F( t' {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 D1 Q$ U( g5 r6 H1 lwrite('</div>')
/ r$ I- V3 [7 j* |; L}
. b! @! V5 E8 }" Qelse if (document.layers){
) d; r' d( W) m0 d) j' ^1 O9 Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' w' ~. J2 |- ~- F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# A6 X2 y9 [6 }! ]# a* U4 Z
write('</ilayer>')
; y( [$ d. u: S2 T" g}
) G: T/ e5 l8 c( t( _document.write('</td></table>')
; T# t( m7 b9 M# v: ?5 I# q}/ E) ]" f1 p' s- m6 w
}
# m# g3 _8 h+ Y/ z</script> |
|