返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 ^' S1 V6 C. h  ?2 H/ v& `var marqueewidth=3001 j8 l+ }9 d! q, o* H# q' h( w
//高度
8 n! d( _* I1 Mvar marqueeheight=25$ C3 F2 E* A7 r( B; s: T. k* e
//速度(1-10)! b3 I$ \5 g( \- ~
var marqueespeed=3
9 w6 X, U7 u' ~. k5 V//背景颜色
) j. r4 Z: y! G% ^! s& ?' l2 [var marqueebgcolor="#FFFFFF"
& x5 U5 r0 H1 k/ F9 T% f4 U& ~6 T//是否能暂停 (0=no. 1=yes)?
6 e7 W/ z$ U: x( y! s( ^% {var pauseit=1: n$ o  @1 R& m3 q

" B2 j2 e5 L2 e) o+ `; z//修改显示内容: `. M7 P$ P& T# i2 {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') P' x, o3 q' }$ J( W6 s/ q2 e

" B$ r" E2 K+ ]0 O! r5 t1 K- T- g' t2 v
8 @; S; J& {; v////下面不需改变////////////
1 [9 k+ {+ n) B+ H' N- T
/ g- i; z5 L8 r7 I3 t1 t8 Lvar copyspeed=marqueespeed2 W; d0 Y0 d9 z1 h/ M7 I
var pausespeed=(pauseit==0)? copyspeed: 08 n/ T4 I; K! R
var iedom=document.all||document.getElementById7 O; N. X, g5 U( Y: A* }8 @
if (iedom)6 [4 m, l# y$ A0 `. ]$ q8 K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 ]1 I+ E. H5 _# L  Y6 L4 O+ x
var actualwidth=''1 s5 h" |2 \! d; M; P$ i
var cross_marquee, ns_marquee
, K2 M5 r9 {# b3 l
; q1 o' O- m; \2 Nfunction populate(){  q: I8 v8 h; t8 B+ L# o2 L& `
if (iedom){4 j, F% J  g, m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 O+ N8 D; o0 o- ]1 P1 h+ wcross_marquee.style.left=marqueewidth+8; D9 y4 |! p8 p/ G
cross_marquee.innerHTML=marqueecontent
* e; x8 i  S& Z8 a" g' Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  _* [) j6 o5 |0 E
}
4 d4 X; ]5 d8 l" B& k, [else if (document.layers){
: z) z# U$ }" X4 b; H% h4 _ns_marquee=document.ns_marquee.document.ns_marquee2
3 ^+ ^7 C/ |+ T' j  t& \ns_marquee.left=marqueewidth+8! {- g- l  d( S
ns_marquee.document.write(marqueecontent)
. `2 h8 Z, G& _) v+ C  Vns_marquee.document.close()
# S- w4 A% A5 H& [actualwidth=ns_marquee.document.width! D% ]) w& i0 {) |$ b% Z
}$ q  _3 t$ `3 F# E
lefttime=setInterval("scrollmarquee()",20)
( p  z$ t3 O: V& D6 i}9 \& G7 j1 D" n
window.onload=populate5 _6 @7 N4 S# [( R: {# F2 d
8 Y8 L# l. A& E& P+ r, |
function scrollmarquee(){. I. R7 h( M  G. i
if (iedom){
1 X: }! `- \% \4 b, X! Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 t; K" J, e4 n# x& U9 I( R5 k0 H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ B2 n: [7 K( W* ~" f6 N
else
) ^* `, z, e( Rcross_marquee.style.left=marqueewidth+87 T7 v5 b6 O+ L) p# \

) j4 o$ f$ I8 ]; m}# m5 G- A5 L4 `' ?' I' M' k
else if (document.layers){6 N8 _6 y9 n$ u8 n. `
if (ns_marquee.left>(actualwidth*(-1)+8))
8 d" t+ ~$ E& v. _. P; jns_marquee.left-=copyspeed( g2 n$ R. E8 w$ K# g6 _  Y
else# r3 z/ y3 ^9 u/ U* J
ns_marquee.left=marqueewidth+8- |, a8 C# e1 Y7 [
}
6 u* s$ ]: y) C}
, p& ?, z% l1 s' C) [
0 w/ \# k+ i) l3 Gif (iedom||document.layers){
, y( C1 c4 s# _5 Fwith (document){  ~* `0 e2 g4 n  A0 b+ t) s! T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ ~- e5 V% g1 R# ?7 rif (iedom){/ ~) _0 _" V# Q7 Q" ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* L* [) U  {# d  E- V% ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% |2 S- X2 h' v- B" x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 y- M% H+ m) Fwrite('</div>')
8 L( t# N. z0 B1 k0 `" ~}
# Y+ x$ D2 E" q2 M) Belse if (document.layers){9 j# O& X4 p$ M5 P2 x! o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 I5 K8 g$ M/ b2 h+ n5 t; ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% Q5 D. J6 G1 B# d% Twrite('</ilayer>')
% M) R4 i) n0 s4 p}
3 @9 O8 O: r6 k- T. Ydocument.write('</td></table>')
/ f! ^6 V) V! j* d}- |" d( x9 e9 {* e/ i
}
$ [, j, V3 \) P2 i</script>

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