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

|
网页之跑马灯文字特效
//修改宽度
) c4 }9 E) l4 Qvar marqueewidth=300
! I3 B; B$ u6 d' X: h v//高度2 l M. i! A0 v; {
var marqueeheight=25
( X+ f1 x% H2 J! Y% E u; G//速度(1-10)7 @( b4 q. ]! {4 x+ b* o& P
var marqueespeed=3" K. |7 b; e5 y: f
//背景颜色
- W8 c/ P; x; v, s, E, g- }var marqueebgcolor="#FFFFFF"
8 E; O; d+ w$ j% y, u( Q$ r//是否能暂停 (0=no. 1=yes)?4 G7 x8 a& n5 B0 \$ h& G( e
var pauseit=17 X. f7 p6 P+ _1 E2 {
! S, p" G3 q% n" N6 N% x6 Q
//修改显示内容: X4 |3 G; l4 k- P9 O; p8 A0 v) D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ x) N( V1 W; c
$ y7 R8 V+ N$ M* q v% [5 B- f' @
0 \9 R& t3 I! w: Y. b. k
////下面不需改变////////////
+ ?+ P/ y) s* ]4 `2 p
5 v# {2 S1 |/ V2 |6 q1 Wvar copyspeed=marqueespeed
& l [. j3 c1 \var pausespeed=(pauseit==0)? copyspeed: 0/ i8 s; \; \2 A# [; L" R) L
var iedom=document.all||document.getElementById: C1 A0 u* m9 t/ T9 l9 c% n# e+ H
if (iedom)
2 a' V6 L% p ~* \, N! Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 ?3 ` a4 q' w# }( L0 ^0 ?
var actualwidth='', _( D* ?/ a3 L$ O) ^, _$ x. w( P
var cross_marquee, ns_marquee
0 N! m, l1 S7 V4 H+ e5 K8 g9 r- @7 M0 |8 \ d+ H
function populate(){
6 t+ h. R+ m2 s' O0 uif (iedom){
0 J, |% Q8 ?5 bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 j) L& b/ D9 W, |" ^cross_marquee.style.left=marqueewidth+8
7 \: }' |: w5 m" Z& H- ncross_marquee.innerHTML=marqueecontent
$ _, A2 `% {5 M8 ~6 dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. @' b8 {( {/ j1 F" M p/ G3 K. \}
& k o: @+ G1 J% ~; aelse if (document.layers){% |; }4 J2 ~8 ~
ns_marquee=document.ns_marquee.document.ns_marquee27 j b" O0 t/ P" z/ |
ns_marquee.left=marqueewidth+8. U" B- j! T! ]5 F7 V4 [6 O- m
ns_marquee.document.write(marqueecontent); c' y, t3 c3 {+ g
ns_marquee.document.close()
9 l- D. X3 D! G0 L! Bactualwidth=ns_marquee.document.width. l9 x+ h+ z$ @& S* C
}
3 k7 H. b( x3 llefttime=setInterval("scrollmarquee()",20)3 J' O/ h4 e/ ], V% q7 X
}
/ ]. a2 v |+ Q7 S6 C- Dwindow.onload=populate
+ E/ Z& U' L8 m |8 A4 p# L0 C6 ]) X( z7 i, t
function scrollmarquee(){
0 {5 b& W8 [' @* t% l5 Mif (iedom){
$ G, J* J( S! N+ mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 t7 d* X) s4 F7 D5 ^# y4 Q; Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 E+ ^- b2 D- T* l' |) Ielse
" ^! Q: \- F2 ] o) a- U4 Jcross_marquee.style.left=marqueewidth+8
# Y7 F9 U0 o9 Z& @
1 r. t/ H- S* _7 f}: T' k! w; v& N% j
else if (document.layers){
6 O( J- a$ p% P) ?+ ]if (ns_marquee.left>(actualwidth*(-1)+8))
' k9 i" s* o2 e7 V: i1 Kns_marquee.left-=copyspeed
# v5 {* P+ r* [' v& l+ `" m# nelse( B9 R! V& U8 a- k$ ]! Q1 r1 a
ns_marquee.left=marqueewidth+86 s3 p7 ^$ e6 e% X5 |: \# O
}1 l% S9 u. n. p+ J$ H: G
}6 a1 A _ G+ W# K% L
0 o; W& t, p& f% S0 K5 g4 z4 ~if (iedom||document.layers){
2 O- N! X/ {. z8 mwith (document){
! q5 x+ J0 k$ F* f7 u. J3 c: c" y vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& o" i0 A1 p0 R) l; s
if (iedom){1 w' q9 s& `* X9 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; X- [$ Z& R3 N% S% Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 y" u& f9 S: @1 T) C3 X) F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 a: ] h7 m& ]: ^
write('</div>')
" z! l2 z0 k4 `, i# Y) z# I/ j9 A}
$ P F6 [' A% ^. F( q# \ Celse if (document.layers){. e! I1 Z7 Z9 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 m9 X! y* E( G- @5 L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), G0 e* E$ F" ?' w* v. t# B5 _
write('</ilayer>')
7 g% t/ k5 v5 i9 M/ L, [5 H5 m}' a" \7 Q; J" E: ?- L3 @2 j _
document.write('</td></table>')
' Y3 E7 {+ M- h}. }2 w2 d3 {& D* m9 T' B
}
^6 x' l( k( O. J' M' M</script> |
|