返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 T9 Z+ [0 c3 V/ ~. U" X* w& z
var marqueewidth=300/ u  i+ P/ T8 F) v. x& D
//高度
0 e% y5 i$ U" r8 m6 jvar marqueeheight=25
% _+ ]2 b/ ?6 Z5 Y3 Y//速度(1-10)
& y& E0 j) t' d' ^# S. Xvar marqueespeed=3
! n# K9 e2 m$ g$ ?. @//背景颜色6 R/ x- Q3 t+ Y# F1 ~+ m& Z$ v
var marqueebgcolor="#FFFFFF"
# f; S0 U- w2 N//是否能暂停 (0=no. 1=yes)?! D' ^4 c) m3 d/ s8 ~  }$ G8 I$ S  `4 e
var pauseit=1
  u. B; H! Q$ @3 S  q8 X2 \- p" P6 H
//修改显示内容
: n6 c! r1 t  Zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# G+ L5 h7 _$ r/ d: ?; W; K, l
% o1 T0 ~: F0 D3 f, d1 A
' K' x6 r+ A( ^0 [/ y////下面不需改变////////////
  f- \( ]' B0 X: V/ M% N. d1 e. K. b9 U/ K% Z5 ~
var copyspeed=marqueespeed
0 u& z& ~3 ?8 X! ovar pausespeed=(pauseit==0)? copyspeed: 0
% r. @; x  {6 s! W9 evar iedom=document.all||document.getElementById/ C8 ~4 L9 V! U( R1 L$ [
if (iedom)2 b* i! F. r, |! v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ ]' i  b" }, `, z9 e! r# n1 u) J
var actualwidth=''" A/ w% ]- F0 n4 y3 J% p
var cross_marquee, ns_marquee$ H2 k3 p) G! K# m
, W9 R9 h/ o9 s7 v
function populate(){  K4 y- F% w7 }( }2 [* A0 Y
if (iedom){
& m& b& d2 ~4 r/ E" `2 ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: k  y7 m, S- q* A2 c8 hcross_marquee.style.left=marqueewidth+8
7 f9 M2 U/ z1 f" Kcross_marquee.innerHTML=marqueecontent
- e2 ]1 w" o9 @5 L1 m) Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  I# C9 ]6 u2 C$ c' N
}
8 V5 R0 w! N  @; C) Lelse if (document.layers){5 W' D, `  F! F6 j8 M
ns_marquee=document.ns_marquee.document.ns_marquee21 D  N1 d) v9 S& y9 ?# v
ns_marquee.left=marqueewidth+8
- [; P# Q' @8 W8 }( `& W% ins_marquee.document.write(marqueecontent)
& q5 q% T; K9 b0 xns_marquee.document.close()& H) E+ }" l( q  r8 m
actualwidth=ns_marquee.document.width
0 v% w) k: T/ n+ L3 P3 ?7 u* g}" a5 k$ G6 X- d8 O
lefttime=setInterval("scrollmarquee()",20)
8 {( {1 k, _6 K0 f- m3 E4 Q}% w# _9 O1 P. a0 {( [4 L
window.onload=populate. g' S$ V+ P1 x' |+ J3 G

* ?2 V' c! W! v- R7 a" }function scrollmarquee(){
6 o% k- x2 N0 M3 Wif (iedom){& p; C' M' b3 u# W( V7 m7 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  Y* V5 C6 U# |" z/ ^4 l% B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ p6 Z% s2 J1 D& l& @, }else' X" C" M. n9 p4 @* l/ d- g+ r+ ?
cross_marquee.style.left=marqueewidth+8' s- V5 F+ {$ h; r( P  [
* d' @& Z/ `1 V% d1 L. q
}
: R( x, M, ~$ Gelse if (document.layers){
. p; F. n1 Z& @$ f1 ~  o& fif (ns_marquee.left>(actualwidth*(-1)+8))% v, t' ]1 `1 k
ns_marquee.left-=copyspeed
+ S9 a8 d4 e+ D' a) ^else' h+ h0 S4 b: [4 z7 v
ns_marquee.left=marqueewidth+85 s( a4 Q) M* |  Q
}
; Z! T# ?2 x/ E6 I1 H) C) d6 a6 ?}
! k+ w" [9 Z0 i3 ~" i/ p4 q7 w. o& o/ {" Z
if (iedom||document.layers){9 i; r: j9 e/ O# i9 \
with (document){
7 L* F: P% Z- Q* xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# F9 w" l$ T8 M) U- V
if (iedom){
" G0 q0 P3 @, cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 P. i: i, b1 h6 d5 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% R' h5 Q% @$ d, B  T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& m8 A' |# c( h5 |" Y; c
write('</div>')
% u0 M9 f: P4 Q+ H/ Y  [& z% O7 u}% h0 ]0 y! J! g+ i3 H* \
else if (document.layers){
$ `9 I' n6 G% a, J% ^6 Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; ]9 C' Y% `, |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 J4 w1 m% ]  v/ l% Bwrite('</ilayer>')  _9 H7 L8 s% I. K3 C' _
}
- u0 z/ ^( e/ d8 c+ rdocument.write('</td></table>')2 m' [2 c# ?) \/ j" q; ?
}3 X% Q6 w% d6 K+ w. Z% X( A6 u
}8 m- ?+ b; J8 ^- O& ^0 s
</script>

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