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

|
网页之跑马灯文字特效
//修改宽度
E% D. }; l9 rvar marqueewidth=300
7 d& U* m4 X0 l5 w# A//高度: ]# X5 z+ f9 e3 _
var marqueeheight=252 u. }2 _6 S) H" I
//速度(1-10)& J, {3 x2 }( O2 G4 V4 u
var marqueespeed=3! T3 Z- F4 |" r# S6 }6 { T
//背景颜色+ h4 N8 j/ {; M( z. S+ o
var marqueebgcolor="#FFFFFF"8 @9 G) v0 t1 H2 E+ [! K3 e0 g
//是否能暂停 (0=no. 1=yes)?( \& O; S% w H( P. L- h
var pauseit=1
3 e4 Z' T6 [; i# @0 r5 k+ y
, Z( d9 @) C2 U" p: d//修改显示内容) a' J: w% X* n2 h) r# P" R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# P6 x2 N4 u6 H8 R% b/ j5 ^
) }1 q. P0 n) g4 B8 R/ @
. \2 t) O) u; q, J5 [1 A
////下面不需改变////////////
' B- L; l$ i6 L
0 b: a) b3 [+ Evar copyspeed=marqueespeed
6 a0 w4 k# ^) w1 Ovar pausespeed=(pauseit==0)? copyspeed: 0
! n/ |3 {$ m+ N. q, z! ?& c4 ^* b2 Svar iedom=document.all||document.getElementById
$ L' A6 C6 G. m7 }+ _/ y) Pif (iedom)
3 S5 w. c- |; bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 N9 }2 S& J, E/ c. J$ p% \var actualwidth=''
! I" p, X* J3 o$ m3 r6 v8 Uvar cross_marquee, ns_marquee
& k: q7 B0 `: W; G( Y0 D1 K3 J$ r4 k" l/ q( w* K7 L! ~
function populate(){
! U6 g+ e- X4 W$ g! h, ^if (iedom){
+ x& i2 a; V2 s6 `8 Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" g* r, a, L4 e1 ?
cross_marquee.style.left=marqueewidth+8
: r* v0 g" v/ W" H y+ ncross_marquee.innerHTML=marqueecontent7 G' {% C7 W, L- |* I
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! r2 C d5 e! k. s$ C7 t1 ?}
2 _) c" `% l$ Xelse if (document.layers){
7 Z2 e7 g" D3 B# v: O$ {ns_marquee=document.ns_marquee.document.ns_marquee2
# U) g8 m7 k q; Mns_marquee.left=marqueewidth+8- \, `' M6 v u4 T* K' Y% I& T6 C
ns_marquee.document.write(marqueecontent)
% o& Y+ z$ x* \8 [ns_marquee.document.close()
* k* A$ ?+ V ~* jactualwidth=ns_marquee.document.width* g" t, [$ P6 g" P
}
Z0 [6 B+ m7 Z" z: D) X* elefttime=setInterval("scrollmarquee()",20)5 I8 `% p4 e" q7 W0 F9 b
}( e, F! }! C! G+ t+ g% P
window.onload=populate" L5 z' w! C% d: e
* o Z% j* I$ T4 r7 Y4 S ?% P9 [function scrollmarquee(){
; a9 y: v0 b" W' u4 }5 l! t; a* Aif (iedom){* S' H( ]& K6 L2 u9 M) ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 \) P4 I& f0 b( K5 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 a# O# o9 K# k5 {8 Yelse
; A4 X! b& ?" hcross_marquee.style.left=marqueewidth+87 O( h3 g7 y' k, X
' `4 h+ a7 F. {}
9 |- u8 z j$ d$ E1 K+ Ielse if (document.layers){! {0 h1 u- e" `0 b4 d- q0 F
if (ns_marquee.left>(actualwidth*(-1)+8)): G: V2 N* [& {, n1 o5 |2 U; q
ns_marquee.left-=copyspeed, J. p& i+ V; Y" _
else, G* {1 d' a7 s6 G4 z+ \
ns_marquee.left=marqueewidth+8
8 H- X |6 ]% B! v; D O0 G}
. L/ e1 |# \% F( t" f}. Q' K* o$ n( u3 c) S6 ?; _
2 U/ J4 b# X$ s4 ]4 F2 E
if (iedom||document.layers){
( g3 s( {- K: t) _4 y* `* Mwith (document){
/ S9 N8 E H6 F3 o, T# b* W; Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& o8 s+ f4 J9 K
if (iedom){
% u& d: }+ n' Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" F4 Z m: y4 c( G8 g7 n, y K' q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 Y% B: r, m6 w8 r$ D. ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! k3 E4 m( ]' `
write('</div>')
; ^! d% y6 G6 N! Q2 K}' q& F$ t+ v. q' c( W
else if (document.layers){
* n# z- Z- T" q) o( v4 T1 @. v9 s3 b1 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" ~0 ^7 b6 q. \3 u" q0 ~/ K& Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ [: a4 u: n1 ]/ mwrite('</ilayer>')$ z9 j5 H8 s4 `6 s
}- n5 F: ^- P; i/ ~1 |; T1 y7 h
document.write('</td></table>')$ E I3 E0 c+ x+ I+ W
}
7 L0 ]2 Y! q8 s2 W' @8 c7 q}& a$ y9 H3 C1 q
</script> |
|