返回列表 发帖

网页之跑马灯文字特效

//修改宽度' n; q6 U. w2 P: _4 t
var marqueewidth=300- ]( D% O  f9 U3 q2 M) O  Z) A6 ?
//高度( C9 e# @& t  I( B3 i
var marqueeheight=25
9 c* ~% v4 R4 p! w- T//速度(1-10)
* W6 N9 Z- ?( O4 [# [1 D4 p" Jvar marqueespeed=3; Z# g4 U: [) j3 d9 W
//背景颜色5 n* ?4 q+ d5 W6 A+ B/ {
var marqueebgcolor="#FFFFFF"
& ]: s  l6 N' L% N//是否能暂停 (0=no. 1=yes)?6 d3 q0 r$ _( e# _' }$ p0 L6 ^
var pauseit=1
; w: F3 {7 `& f! g% l! z0 Y6 ~5 I" o9 K2 T
//修改显示内容
" [1 A$ g/ A9 y: x5 W" avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' z7 Q* f3 Y$ o! ?- ~

7 K1 K4 Q/ y' [% J# V8 d1 `- W3 a. u
" g* x2 H* |: A) F; @7 G////下面不需改变////////////
8 X, F- m' z% c$ Z5 {; W; {7 Y/ D4 U7 }- T8 T  E
var copyspeed=marqueespeed
- [- b7 Y" s1 lvar pausespeed=(pauseit==0)? copyspeed: 0
" ~2 ~$ F  r) H/ A+ F; Uvar iedom=document.all||document.getElementById
* Q* {( `+ O" V" Hif (iedom)
2 ]0 G' O# C; ~* o! z6 J4 S' Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 j4 G! f3 Z0 V5 A7 W. o7 A1 ^7 X9 ]var actualwidth=''
% T2 G' K# |& x3 tvar cross_marquee, ns_marquee
: q' w3 I5 J7 F3 N, l9 Q2 ^. @% C
+ {& F* m1 a0 e2 r6 Z2 efunction populate(){
6 V/ X. D$ l/ q9 W2 j5 eif (iedom){
- g) f/ j. c8 C7 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 e2 g; r$ k1 A! I5 @- Bcross_marquee.style.left=marqueewidth+8! T2 Y9 I9 H9 X6 S% i
cross_marquee.innerHTML=marqueecontent& J( V# }! i; ]8 M$ s  W- |4 o9 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 p6 h2 }: w% g3 R}
/ J' g+ e$ x* F8 n, m5 T# Felse if (document.layers){0 Y1 ]7 L/ t! f1 l
ns_marquee=document.ns_marquee.document.ns_marquee27 v8 p  {5 `1 t, V2 V' r) N/ m
ns_marquee.left=marqueewidth+8
7 y4 u! v. t) g7 y4 zns_marquee.document.write(marqueecontent)
+ h$ x. c$ ~8 M$ b; N) w* Pns_marquee.document.close()+ \2 f7 L& z+ b7 x
actualwidth=ns_marquee.document.width
( _2 U/ g+ P5 U! L/ F* J}% R) X2 Z# B) E( L' V& r
lefttime=setInterval("scrollmarquee()",20)
! [! ?+ e# ?$ U: L" k) `& f}& D2 q+ m+ I( R* T2 a
window.onload=populate
* \: m) V7 b) N* N' `$ K1 f; E' X. J' {4 x6 G$ J1 }) F
function scrollmarquee(){' m1 v( v' G+ h) T" Q6 v
if (iedom){
$ X; L. n# p2 }* }, y7 ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). F* a+ b$ Y5 Z( o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- u* J: ]$ |+ E1 Q/ Melse& _1 D! O/ B* Q6 [
cross_marquee.style.left=marqueewidth+8
( m+ ]( M  v( k
& D% q4 n: J" P2 i- m) j' T4 M$ K}+ _* l& y% w9 K# I; ]' C
else if (document.layers){
# D5 [9 o7 R* h8 Zif (ns_marquee.left>(actualwidth*(-1)+8))
9 p0 @  @" {; W3 H+ Yns_marquee.left-=copyspeed. K. l+ N0 I! D2 F  g8 L
else
9 s/ U8 q1 @4 f  [ns_marquee.left=marqueewidth+88 p$ O2 E3 [% B( z
}
  n! g2 j7 J: }}
* w, |; ]4 X  ~  h' d' w7 j' o/ w; M1 v2 I8 X
if (iedom||document.layers){1 }% _( Q* K$ B8 x3 J
with (document){
$ f& e5 w; y( g" L6 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. g6 E) C( R9 M) lif (iedom){
# F" R0 @7 X5 G9 V. x2 |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( k4 T5 o* \, H$ S3 ~$ l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  y" W& i3 m% g/ fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 a% v( g9 r  |6 w" C) u. X
write('</div>')" W* C2 C8 R% j3 v
}
6 L& p! a' d5 l0 o) f" U, o5 Zelse if (document.layers){
' m# h) S7 S: Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, T9 Q- E" e) ~- |, jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% _9 V4 ^" F# S% Bwrite('</ilayer>')
$ F7 f- U+ q7 a( J}- t* a2 l  F' l  J: D2 }8 R
document.write('</td></table>')
: T+ V: r+ T* ]1 |) {  G}5 s* e( q* s7 P* k
}
! r5 m) C5 |* m. S</script>

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