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

|
网页之跑马灯文字特效
//修改宽度
! x. v, i; W G% X B [var marqueewidth=300
0 f- E* }3 { W$ s; A3 u" _//高度6 E$ X/ a9 A9 t% t! e3 I! c* u- b
var marqueeheight=25
" {1 F. |8 @5 ~9 ]; Y% P//速度(1-10) V# b% O$ q, b B
var marqueespeed=3! F+ i6 p9 y* z2 A/ E; `
//背景颜色# Z2 I# \9 p; V7 b1 l9 d5 g
var marqueebgcolor="#FFFFFF"
2 o: ~3 {; w! d3 |! u3 A//是否能暂停 (0=no. 1=yes)?
, {& y \9 j# M0 n' v. x7 C Q+ Fvar pauseit=1
* U( X0 e: V+ y* y: E' k* ^! R2 T1 u8 i# Q
//修改显示内容
5 f' g: O" n9 O4 d, H# Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 _4 o+ i% x5 }- k+ u9 E) T1 O. f8 @1 e; e. S# ^
$ S; B% b% r' A2 k$ t////下面不需改变////////////; X6 o& S& Q3 F# G6 l9 d
0 U( u4 x4 n7 K1 n" [$ j* {var copyspeed=marqueespeed. n+ T4 T% j- ?
var pausespeed=(pauseit==0)? copyspeed: 0
7 k; H! n" |6 F: \; ]: Zvar iedom=document.all||document.getElementById& n7 X3 p a; h: m% ~7 }
if (iedom)+ {9 g7 [$ m0 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 e V3 L3 R" U( b/ p9 N
var actualwidth=''
Z& Z0 L2 j0 Y. w$ Z5 ?7 Qvar cross_marquee, ns_marquee
9 ~ o# G! _( F! ~: j8 {5 L( W$ G" u& s$ d$ X X+ a
function populate(){
8 [% `5 l- ^. e$ l+ o* M/ c$ yif (iedom){
. a1 x" y- Q0 I% x2 j; Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" a7 K1 @2 q3 W+ Q
cross_marquee.style.left=marqueewidth+8
8 G J; I( `( X) ?, W2 d8 ^% |: }cross_marquee.innerHTML=marqueecontent
9 h6 G& w7 g" s; r& kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' J$ H0 _" N9 |- Y6 p}
! c0 ~3 E! ?% J( e6 D7 belse if (document.layers){
5 [0 T4 ^- s* ]( k4 yns_marquee=document.ns_marquee.document.ns_marquee27 v" |9 r# C' T7 T5 \9 l
ns_marquee.left=marqueewidth+8& A& @( S2 h8 H0 [ a
ns_marquee.document.write(marqueecontent)
% ]3 j* W8 D2 Jns_marquee.document.close(). w6 o/ V. M% @% m) [* P, |: m* w
actualwidth=ns_marquee.document.width$ v8 A4 s) M2 ?( q* n! s7 L! o
}! }9 h4 O1 u# C9 I6 E: l1 x
lefttime=setInterval("scrollmarquee()",20)* @5 t; T: U5 t
}2 `6 D" w1 F# G6 I( ?
window.onload=populate
, @* ?+ [3 b. n+ a/ u0 X. z2 @2 o6 u! f7 E! }
function scrollmarquee(){: g+ ~1 P0 R9 {. n4 ?6 ?: O2 [( C
if (iedom){) O7 x% d6 R9 [# S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! B. U" D' K: w. u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- G- W% h. \* c O; }2 selse( y5 T+ {7 Y2 q1 q9 u7 W6 A7 K
cross_marquee.style.left=marqueewidth+8
3 Q S/ S! N* y3 ?% F
. b, Z9 f1 o/ s* ~1 p4 a+ \}; h: r# l$ J/ s# y
else if (document.layers){
+ W! p5 X: e4 n/ eif (ns_marquee.left>(actualwidth*(-1)+8))7 [1 T/ j8 N+ E7 _7 I
ns_marquee.left-=copyspeed) x8 z. N a# V' e
else1 n( x0 j9 b0 b* }2 v# O1 S' U! G
ns_marquee.left=marqueewidth+8
: b L) H6 Y- T' F' ?0 I- W2 W}
+ `* @* Z3 F& w# z7 r% H% q# F}
2 Z1 Z- B- l* d. z8 L+ e6 ^5 `) ?; }* w: E
if (iedom||document.layers){
" O' b5 ]+ `0 Mwith (document){
9 L" {( |) ~* f9 Z d+ ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ b1 g+ |1 M7 k3 Dif (iedom){3 `: a; G% ~5 J& ~# e) c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# S2 `2 ^ H+ G+ S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 L$ a, |1 z. B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' h3 f( k8 g7 ` |
write('</div>'); _2 N( J6 Y2 d! k
}7 T8 Q& ?- _# y6 y' b# P+ c
else if (document.layers){+ G: G! {5 z2 ]/ {% q/ x! u. `! N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- ?" H0 t F. k R; D$ ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 s4 d: h- A* L& R* q8 B
write('</ilayer>')
6 p0 s5 P9 @; f2 }( I, T: K}/ U' w4 n3 b: I- [3 w( `- A
document.write('</td></table>')3 g) C( V8 x% e
}
9 Z4 Q" ^* a2 n% z4 o}
" n) Y0 a5 {) n</script> |
|