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

|
网页之跑马灯文字特效
//修改宽度5 S& G* D" J% k# C, x3 i
var marqueewidth=300- s% @! i+ p: S
//高度- w, {5 [6 ]3 c" n# Y
var marqueeheight=252 ~1 }- U. Y8 R; F. o# M9 [
//速度(1-10)
6 w- p6 x. o6 R) Xvar marqueespeed=3. Y/ K: T# i8 l/ r& i. k/ M
//背景颜色
" n/ n! A9 H! c6 ^var marqueebgcolor="#FFFFFF"
" ~, j. [ y) u3 G: P2 U//是否能暂停 (0=no. 1=yes)?! a& D5 a) c9 R& M3 S6 M
var pauseit=19 h" ^" s; G. h7 W1 y; t; m! _5 [
% O) r/ { Y+ P/ I7 O//修改显示内容$ r1 G O" \! N9 W, _+ ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ J( Y7 W) x2 a r3 u. |- q8 Z2 k# E( \- X* g, x( X, Q
8 Y$ t( g! S+ W0 p* f0 ]* {
////下面不需改变////////////
$ p- ~7 B3 w7 C0 e& B, f* l% h* ?6 p4 S9 `, g% s
var copyspeed=marqueespeed9 f& c1 O$ ~/ U
var pausespeed=(pauseit==0)? copyspeed: 09 b' R0 ^. r, H4 ~1 j4 Q
var iedom=document.all||document.getElementById4 v: Z! v/ E4 j5 Z0 l- j% q
if (iedom)" [. g& q* [' @! b/ U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; |3 @$ d3 S* F8 `: k& K6 {var actualwidth='': I6 Y( u5 [/ D0 D5 U+ C& P1 C
var cross_marquee, ns_marquee
* R$ h6 Q8 O$ A5 E! R& e( } e0 p2 q" X" w) ^$ c4 p P& c
function populate(){
+ k) D7 B7 e4 r9 jif (iedom){8 ~$ r% a; s$ l* s( C7 m# ? u' S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 x U* v3 x/ q& @/ H* }/ J I
cross_marquee.style.left=marqueewidth+8
- S+ q0 e2 l/ e4 x6 U& ]. U& V0 Gcross_marquee.innerHTML=marqueecontent
; K; Z3 v0 q* P8 Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" o) r- g$ f3 x- b+ f}
, o& T0 B' Z: v1 }1 `else if (document.layers){/ e. c$ w' y1 l6 \# v. r6 G, ?
ns_marquee=document.ns_marquee.document.ns_marquee23 |& y5 F6 O: U& a8 F# V& O9 C& w
ns_marquee.left=marqueewidth+8
/ ?* {2 N/ T& w. f2 _: M4 gns_marquee.document.write(marqueecontent)
1 M3 C1 ~ ]5 d& Ons_marquee.document.close()6 A1 D9 O0 |# J0 ?* s6 ^/ D0 M1 q2 q3 A
actualwidth=ns_marquee.document.width9 U$ l+ W$ B0 ]; d$ Z, M
}2 r, T5 s! J) q3 @4 S/ R6 L
lefttime=setInterval("scrollmarquee()",20)
9 i3 d7 B0 h; H4 C}6 K+ q: K* K; {1 \* O! ~1 `
window.onload=populate# A/ r8 f+ G9 M+ |% ~* M
2 t" |- }- g: h! |6 ~1 ` D
function scrollmarquee(){
* v5 w! J6 b4 p2 l9 [+ X* e) uif (iedom){# W( o. k: U8 W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' v4 b1 Z8 M! s1 _
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ ?: s- [/ d& `0 ^ Eelse7 e; t/ b3 V0 C; v) F
cross_marquee.style.left=marqueewidth+81 n$ R7 e* H# Q2 w, Z
" q5 E# e' P) |# k* k6 `9 {}
& h7 q7 Q; J" h% o6 Ielse if (document.layers){
' @8 k9 S; ?: Qif (ns_marquee.left>(actualwidth*(-1)+8))% `8 M. n" l9 ]8 d# P' V
ns_marquee.left-=copyspeed
# ^3 |5 p7 q7 p' Eelse
4 l) l- W- M+ z. [( R, s' Yns_marquee.left=marqueewidth+84 `8 @& t; z5 J1 N9 J% D% w
}
/ q' G( x9 l; e3 r, C& f! a8 Y( N8 P}
; h+ Y( x9 [$ F" F
" O+ P, m+ a S k3 C7 lif (iedom||document.layers){
& ^. F7 G& f) C8 x; n7 A0 h+ @1 vwith (document){
! Q" [5 b5 t2 ]' \, {1 K/ q" r- U; r- _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# z5 w2 A! X4 Q$ o% v M
if (iedom){; U9 q4 ^! B) x) `! K& `2 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 c; z, }- c! g0 Z: @" v
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" O6 F. p$ p& O* i7 J6 L( Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! C9 H4 K4 _5 z. p) j
write('</div>')
& T9 k1 m( N( r}) U' _5 r, e% I
else if (document.layers){! X0 _, X( z. @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 x8 }$ P$ l5 x! awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ g# P. ]! l7 }: s0 }
write('</ilayer>')8 q4 ^* U- N- D
}
1 j# Q. K- i) I! k" X& gdocument.write('</td></table>')
6 K/ L& }( z( f; w4 I}4 I" G8 f; F3 ?7 o7 {% q5 B3 Z; Y
}. j0 z! r# W; W2 c2 c+ P
</script> |
|