返回列表 发帖

网页之跑马灯文字特效

//修改宽度) \* M; _, P# v. }* l0 K
var marqueewidth=300; g; H0 N5 m8 G! W. M
//高度
. e: I, q' e" I/ z3 p- U4 ^var marqueeheight=252 F7 i6 D( k+ `- p. x7 `8 F- ^& l
//速度(1-10)! X  h) u) B& Q. l$ y
var marqueespeed=3
+ ?5 O  f; c0 B8 A  P//背景颜色
. v6 i* B5 I0 B, ?var marqueebgcolor="#FFFFFF"
3 T1 ?2 B3 s  J1 R  X//是否能暂停 (0=no. 1=yes)?6 W& T. D" C$ l8 {
var pauseit=1& ]9 L; s+ Z  O$ _! x; F
* a( E* i2 ]  Q  {" N# h
//修改显示内容
3 |  i- G+ P) q+ [0 avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( t& ^5 b6 p" S! Q- _. U3 ~

) u' L1 A9 x, w: i0 f) w+ _3 b% ^: N+ {& O; u$ h
////下面不需改变////////////1 E  v9 ~5 M4 j. n$ _+ ^5 F5 c4 q! `
; Z% y- y' ]8 e& i, S
var copyspeed=marqueespeed
" g4 M+ r1 b  W' }4 v% vvar pausespeed=(pauseit==0)? copyspeed: 0: ~2 H, g9 s" G, p
var iedom=document.all||document.getElementById
0 H+ L3 J* G" z, X8 Hif (iedom)) ]: o  i/ E* Q$ ^$ K
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 U( w) N7 W: M4 A  B/ W
var actualwidth='', S0 ]' u+ U- |% u
var cross_marquee, ns_marquee/ ~1 K5 m8 e3 ]) }

7 R( n' A" G0 I2 f5 ^+ Y. |2 }function populate(){
: L4 l; j/ W! s1 T/ l! E4 Mif (iedom){
. Q) O+ f3 k& t6 U/ i3 E' E! rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 t* x. n2 u- y, _
cross_marquee.style.left=marqueewidth+8% E. U! N& p* \: S4 s4 \; [9 A4 K
cross_marquee.innerHTML=marqueecontent
, V8 R% b8 X3 N) |) `% Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- U' b- v2 V) r3 [' k! k, t
}2 ]5 R; y( K& k" V; f
else if (document.layers){# @. J  N" M7 P' g5 d
ns_marquee=document.ns_marquee.document.ns_marquee2+ [3 c) P! \# `  n- I* c( g
ns_marquee.left=marqueewidth+8# m  c5 u2 V/ Z7 c
ns_marquee.document.write(marqueecontent)
& e/ U, }/ N4 _; @3 Gns_marquee.document.close()
5 K% w9 O$ V1 j6 c# L; \1 g8 f8 K0 pactualwidth=ns_marquee.document.width
7 Q9 t5 s, d9 A. I2 G. m+ |}; P& N  l" H) R9 T' `: x- E' j
lefttime=setInterval("scrollmarquee()",20)  P. m1 M* a  F" J( [
}
$ A7 s2 B2 `- E7 ^2 E) [% ~window.onload=populate* H# g! M  {: a; D6 f6 D. b8 \; p
2 P6 {$ n" {& s: m+ B) ]
function scrollmarquee(){
. z* [8 o  f7 l- W, Hif (iedom){
9 p! ^7 V: y" k$ D1 U: Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 @5 i) z! ?' @& k$ ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 T! u# t8 {4 j- d& j# telse, ?9 q6 ?6 i. D8 a5 _; i
cross_marquee.style.left=marqueewidth+8
( L* I7 ^8 ?2 N
6 E1 W4 Y$ M# V7 `$ M}4 p1 Z+ M- h' Q- [. ~5 j; z
else if (document.layers){
# w. y  s# }+ t1 T$ Fif (ns_marquee.left>(actualwidth*(-1)+8)). m6 J. \) p  P: N3 j  i) o1 l
ns_marquee.left-=copyspeed; `4 E. R# N6 n- y- P" j; e
else
! D  B" H+ c- V4 K2 ^ns_marquee.left=marqueewidth+8
# }! W0 ^( ?" B" M}1 `' w/ e: d7 z3 h1 D4 @
}
, Z- B8 i, I3 V3 Z4 f
  v  {0 A2 F' c; H* z: Dif (iedom||document.layers){
5 W5 t! p' Z$ F8 e, ywith (document){
6 n( V9 K$ J/ H* Q9 adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& q- R" c! Z# B4 a
if (iedom){
( o6 r  y; @: Y( ?0 f& h. a0 Kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 |- |( U+ w% X) U! R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; E- t0 ^4 G* V/ h" H- B4 ?( {) Hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% n1 L+ Q! p' W& a( T$ g+ _4 U6 K
write('</div>')
3 I- ^0 `# v9 F, e}& q! S3 O/ Z1 K9 R9 Z) z, H
else if (document.layers){
' L; P9 X8 x  _. v, r* ]) j- rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. F8 \5 @- O' R5 {, ?1 u. Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 ?! j$ |5 m$ ewrite('</ilayer>')7 _1 ?2 z# N" Y( J, b
}8 ?( K1 }. P0 [8 W7 C' [+ S8 c
document.write('</td></table>')
0 Y* s4 m* w- @& I+ _}
. d$ `6 `7 F- t. S( F. ^5 f  Q}9 \8 T$ k3 f9 Y- |
</script>

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