返回列表 发帖

网页之跑马灯文字特效

//修改宽度
$ w6 w4 k, W* a/ bvar marqueewidth=3008 r( M$ f( l9 e2 l
//高度- N& j0 C6 o' u8 s
var marqueeheight=257 l0 A- w, d" j$ G6 ?
//速度(1-10)5 n8 _+ |- k1 e
var marqueespeed=3
' w) A! B0 r; m) I* _% ]- O' r1 W//背景颜色# x3 Z) [+ m7 x; l- g2 M
var marqueebgcolor="#FFFFFF"0 I& f  L' R' |, H8 w- I  e
//是否能暂停 (0=no. 1=yes)?$ [+ C; Y& U( e- w5 s) \$ Y
var pauseit=1
7 b2 p9 I" l; r* k
1 w; p$ }7 M3 L  U0 [5 [//修改显示内容
# G* v/ Q  |( G0 o; g" R, vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 }0 h8 Y3 Y+ {; H3 ~7 {, e# u7 m' |8 Z/ t& |0 {

8 T1 ~( u/ l7 V, E! K////下面不需改变////////////
  i/ n: Q. i* z& p0 E- G1 I2 z. B
* v( h* F4 Y8 \2 `' t' Xvar copyspeed=marqueespeed8 C& X1 c. Y  c: {+ V& @' {
var pausespeed=(pauseit==0)? copyspeed: 0
2 N2 W) N- |, D3 w$ H, svar iedom=document.all||document.getElementById
: h3 `  \  Z/ e$ X7 K0 Hif (iedom)7 V: L5 i; H% i. a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# N" e# ]/ a4 [, J( O; @8 F1 i% M
var actualwidth=''3 m; `. v0 `. Q3 ]7 B9 D, g1 W
var cross_marquee, ns_marquee
( \8 y  k! b; _+ w2 m1 _6 {5 K2 a0 f" W7 k) S3 e
function populate(){
% f6 Y% f: r. X& k$ V( \if (iedom){
& ^2 \% F* y3 ]  v8 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) N# o8 A/ W9 V0 V+ o/ s) j9 w1 \cross_marquee.style.left=marqueewidth+8+ P9 ]/ Q1 e- M- Z4 D
cross_marquee.innerHTML=marqueecontent3 K* ^- C+ E2 i) w* v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 R' X- s% W4 R' `4 R}
+ w9 q/ ?% C" S3 eelse if (document.layers){
( _  W  A8 a/ v# p2 B6 Hns_marquee=document.ns_marquee.document.ns_marquee2
9 n  V7 ~" Z# J5 C8 t/ {6 vns_marquee.left=marqueewidth+8; s  t1 y2 A8 n* e
ns_marquee.document.write(marqueecontent)
" [  v( g, K. M, _& N8 P1 Mns_marquee.document.close()
( ?8 J: f" e1 p+ `* `: [2 \actualwidth=ns_marquee.document.width$ K% h, X5 o; x: [! t/ Q
}& H8 U; [" f0 B8 u% y5 G; a
lefttime=setInterval("scrollmarquee()",20)
* k  D7 y0 Z5 f" Y}3 d; h6 U0 P4 k- ~, L/ M% U
window.onload=populate( T* \4 A3 Z& ?& D8 d
" A' U* c. s* {$ r9 V
function scrollmarquee(){/ }( P3 d: J# R3 q4 Q: T% y
if (iedom){
* Y& h/ k: q+ i. V- M( S9 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): e& _' [4 j$ E! D" z9 k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  S* B5 `; L7 K! b) m7 P
else$ ^0 A+ k( G3 T! V: q
cross_marquee.style.left=marqueewidth+8
9 z, ?0 a! g3 [. [1 z3 L' j1 D& O6 K5 y- R- j9 t
}
3 W* {' S* Y0 melse if (document.layers){
. X, V! `0 J% j6 P5 [+ \if (ns_marquee.left>(actualwidth*(-1)+8))% p9 ~& h) U2 V! F" L
ns_marquee.left-=copyspeed
. e+ E+ P1 U' Velse! h/ v. n% o2 V# _/ |# W1 j0 |0 o6 ?/ ]
ns_marquee.left=marqueewidth+8
) X0 o5 v9 B, M( u) i* ]}
+ v! f3 o+ _3 Q% ^}
; R- w' T8 @! [* @
0 L$ X. q3 b! L) }6 H# Eif (iedom||document.layers){
) y3 n! S( A6 l# P% G/ w3 p+ fwith (document){) h- F6 L, t2 l+ v+ \5 O! b. F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) }0 V  _7 b+ e1 G4 R6 c2 M3 H% N! g
if (iedom){
7 q3 P( V5 S% F2 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 q5 {: M' L  U* V- a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* H  n2 j' O2 t6 B; |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 }4 w7 w, k# J' w* ?7 f) @write('</div>'); f4 q2 L+ ]' K9 Z1 |: x! n
}& d$ m& r6 g# A( i( ], ?5 d
else if (document.layers){
& i: ], g, Y5 dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 f. _0 o' r& Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 [% W0 L4 ^) ]$ R
write('</ilayer>')
# z7 e& T4 [4 s3 W! ?! H5 X% x6 h}
, O' _7 c( X  q0 U5 L+ y/ ddocument.write('</td></table>')4 }( B- W* {* l3 |- s; I$ Z
}+ q8 A; a$ ^, ~& R
}8 U1 c5 |( T! d8 r1 x  V/ n
</script>

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