Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
9 u9 Z, h9 u* ]  i7 f8 qvar marqueewidth=300$ i* L( \" Q# u9 |( [
//高度% _4 F' q3 @: y* C) u
var marqueeheight=25
* g3 V9 Q5 u' M. w* c) @0 k; w//速度(1-10)* J4 y1 C3 j9 B; j0 H( T7 M8 y
var marqueespeed=3
3 i# q4 |7 V5 ^% P5 Q% W2 Y//背景颜色% \. A0 d/ b: V* b' \* `
var marqueebgcolor="#FFFFFF"
% Z- N! O9 ^8 f//是否能暂停 (0=no. 1=yes)?1 f5 y& u. d& N' `! o  ^4 [
var pauseit=1& j. }- V$ M; B

, l3 t- G+ Q' f0 T' k5 k1 r; C//修改显示内容* _+ e* b9 Y7 \/ G9 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 [& r5 E5 W" b! ^5 K8 L7 s# W$ N( r* b" J( r. H1 g
+ i1 R% X! G6 K1 g  _
////下面不需改变////////////& c; u% Z1 W# H8 ]% W
0 a1 p3 x  I0 ^
var copyspeed=marqueespeed: O- v" E& {% X/ H3 O
var pausespeed=(pauseit==0)? copyspeed: 0: M! t. |. o' T) g
var iedom=document.all||document.getElementById
9 E; V' l# N9 Q- @if (iedom)% C. r6 ]! O) t3 |% p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 p7 y9 v$ Z2 C; @1 d, Q1 p) r: Y, bvar actualwidth=''( B# ]4 ]5 X4 x. @2 t
var cross_marquee, ns_marquee) m7 J* ?9 m; h
" M) V8 h' W) F6 T9 ]5 E
function populate(){
3 b  H9 n1 R$ c1 P" p& \. ~) jif (iedom){! A( I8 w1 I# `: K' `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; y% j) z& S2 e' @2 Zcross_marquee.style.left=marqueewidth+82 X) ^+ y. {. c# \
cross_marquee.innerHTML=marqueecontent
, ]& U* {1 j. P4 zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 x% d# p) m! v2 O( F( o' f
}( \, p4 ?" n) l% O4 I
else if (document.layers){
3 l: W) H9 i- L! o* yns_marquee=document.ns_marquee.document.ns_marquee2
: c; x7 b( R  q8 Bns_marquee.left=marqueewidth+8
2 e" {0 g- Y+ t3 |- Q3 C- J% }6 ~ns_marquee.document.write(marqueecontent)4 f5 o+ N; Q: g1 q5 f- T
ns_marquee.document.close()5 _- g2 [2 Z0 z# K6 A
actualwidth=ns_marquee.document.width
- d1 X( y1 G7 `9 o9 m}
: B# L5 n: [1 Ilefttime=setInterval("scrollmarquee()",20)
9 F4 n7 _3 O) [' V}( }# V/ s5 ~% f
window.onload=populate
4 T" Q0 s" _* R0 Y
8 i$ Z5 F5 {7 _* h% i% Hfunction scrollmarquee(){( ]- s3 y/ v$ @- K
if (iedom){5 z5 |" b# o4 F0 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( o) Y" q& M( K" h7 W7 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ ~& n+ M. \4 s- Y
else
7 P. U$ ~) q  H  Z( ~0 ecross_marquee.style.left=marqueewidth+8! d; P8 Y4 ]$ ]4 r& w. Y3 g3 }3 e
1 l7 J; t5 E# x7 t% q
}
0 a0 v" S: n# q1 Y; u& Helse if (document.layers){/ W7 n' I& F# V# w  J
if (ns_marquee.left>(actualwidth*(-1)+8))0 ]& q' I) O, t$ r$ j! c
ns_marquee.left-=copyspeed5 Y' \* H/ G5 d6 G1 p
else
0 P# |  W% t5 V5 T  ?- n5 dns_marquee.left=marqueewidth+8* Y. ]0 s8 U" b: G8 n
}
5 B  M# X- p# H# y5 X6 R3 S}; @! v2 e- l. {/ I, h2 ^4 c

/ d) c# {& z! t, I- ]! d$ Pif (iedom||document.layers){7 G$ q8 q" H5 {9 l6 a+ S
with (document){
' e" @' g5 G& k. L6 Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 W9 d! a: x, X3 t: V
if (iedom){
. ~! _5 l/ k" \+ rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 ~9 z8 H: J5 n& G0 G3 X# A  N6 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# A, z( r% B* J# e7 L& i+ awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 Z8 l4 i* k& N% z; q) c6 o
write('</div>')
  g0 X/ x/ r  i3 }- Q$ s}
/ |7 c( ]7 q, J$ y3 M7 B" yelse if (document.layers){) w; W" a3 v  [: X
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  C9 r1 r8 E! V# e5 A! @2 Z0 gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" P' @, {- X: O0 P' u5 dwrite('</ilayer>')
. z! H9 C  t+ k5 |}
) [% \; O# Z# P; @$ ]2 cdocument.write('</td></table>')4 o( |$ r/ \0 @# v
}
4 o$ `  T1 v% t& B}! I0 C6 {8 M  c9 Z, j+ X
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2