|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
% j$ B$ k7 x7 ]/ o; u T0 ?% N) pvar marqueewidth=300
$ }' D9 v9 E2 M8 ]. l//高度
: l6 w5 A7 t, Bvar marqueeheight=25. ]9 Z9 g. M! B
//速度(1-10)( K" \6 @7 m& Z: E
var marqueespeed=3& Y5 e& K+ B z6 Q g
//背景颜色9 F h$ C7 @2 ^) {' N- v" D
var marqueebgcolor="#FFFFFF"7 I& e; w$ X; H
//是否能暂停 (0=no. 1=yes)?7 T* R+ X: W; S, `
var pauseit=1
' O3 x9 N, n. w3 u' V: Z4 g1 i0 {% a# l6 ?2 [
//修改显示内容+ Q4 Y% j5 `( S I; X* z A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ v P% l% G) `
$ G2 R- ~7 H) \" N# U
- k4 t5 m" y5 q( ? M+ T* s////下面不需改变////////////
8 w2 Q( F0 }7 f' h5 n7 k
+ h2 z# B8 V( R- i9 M6 cvar copyspeed=marqueespeed, u; f! n+ l: b7 ^1 r& j
var pausespeed=(pauseit==0)? copyspeed: 05 t/ ?- S& o. B5 A0 W4 Q1 c, K
var iedom=document.all||document.getElementById/ ^, ]0 H9 w1 `, Z
if (iedom)1 T8 V' B% C0 o: ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% M& x) b9 Y0 t6 z% w
var actualwidth=''
( g/ C: e4 ?4 E' F8 ^3 \var cross_marquee, ns_marquee! g/ Z$ G- e' I/ e% `2 e4 F
/ @, h1 [1 S5 X: [; v2 \% v
function populate(){
3 w' D) b2 W+ y- W. ]if (iedom){' \2 Q" C8 U. V; [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" D! J6 c, y4 P. @5 Rcross_marquee.style.left=marqueewidth+80 N" g6 Z/ ?4 ~! I* A" b% W& b r
cross_marquee.innerHTML=marqueecontent
7 S# j4 R# M3 ?" B L* Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: {# e2 k1 D; ?' R8 A$ D- J
}
5 f2 i6 u& l6 f. [$ l' I; felse if (document.layers){
9 e9 K7 o9 X2 s9 T8 X4 Gns_marquee=document.ns_marquee.document.ns_marquee2; w! a" [# A6 T
ns_marquee.left=marqueewidth+8
) E6 R9 y4 `3 d5 Y0 k8 ins_marquee.document.write(marqueecontent)5 L$ P( @( e/ K, B+ a
ns_marquee.document.close()2 Q% n9 s9 H( D) y( n( {
actualwidth=ns_marquee.document.width
( H' Q: v+ p$ u7 [4 L- I% r}8 I' {$ q. Q0 p4 p' P
lefttime=setInterval("scrollmarquee()",20)
" p) n$ m( v4 s O" ?}
. _3 d5 @& p2 @window.onload=populate
9 \9 m W' X% v7 J4 K# O
" c" R- H4 _2 q. p6 Afunction scrollmarquee(){
7 `/ }6 Z }* S' Uif (iedom){
' Q2 W* m+ ^3 i% zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! u( Y3 R1 H, G+ Z ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( P& c# K y( e8 }& f3 eelse
6 B& a0 q6 G; M. a# i& J( Ycross_marquee.style.left=marqueewidth+8
- L" |* p. D/ }3 J. _% T7 x3 ^( p6 T
}7 Y2 Z- v n. v1 G' i2 N( B
else if (document.layers){
2 U) q# u& U* w* @if (ns_marquee.left>(actualwidth*(-1)+8))$ t8 i, b, O3 z* U1 Z9 j& B
ns_marquee.left-=copyspeed
' `, f. ]$ C+ N- e9 A( Felse
$ e9 r" e0 B% V: _' F' t4 S7 D% lns_marquee.left=marqueewidth+8
: c* O; `. e3 f& b}
/ x7 r" e, { ]4 N}! W& E$ d4 H( n
3 u* }8 I; T$ U% b- Sif (iedom||document.layers){
% ^1 H( t. y+ `$ D; B8 t& _with (document){' p" U- n2 t# {! \$ {
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ N7 ^/ V, O' s$ O0 t' e$ Y9 a* pif (iedom){
1 z0 }* u2 ]4 F s, Y8 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; r: K! Z- H6 c3 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 h& E9 R9 a6 L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 L9 I4 K0 a, f+ nwrite('</div>')
9 Q* |( o- {' B( e$ x. I}
. ]# Q. I4 i; E3 qelse if (document.layers){; z9 y* x* o6 Z- c! \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ m- s9 i; n: P9 a% H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 f7 N% [8 J5 X5 v( x) M) ~
write('</ilayer>')
$ [, Q% q% a1 V4 N}/ `5 G" q% ^; q' C- V, f
document.write('</td></table>')
. N7 v1 s- G6 {}- b$ Z$ C( Y# `7 W
}
/ _" t Y# L- Z7 d# x" e</script> |
|