香烟 发表于 2007-4-27 10:24:19

***综合类***结合的很酷的文本滚动与网页飞花的特效!!

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<script language=javascript>


//设置marquee的宽度(in pixels)
var marqueewidth=190
//设置marquee的高度
var marqueeheight=200
//设置marquee的速度
var speed=1
//设置marquee的显示内容
var marqueecontents=

ef="<center><p>加如文章的内容</center>"

if (document.all)
document.write('<marquee direction="up" scrollamount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'">'+marqueecontents+'</marquee>')

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
settimeout("window.onresize=regenerate",450)
intializemarquee()
}
}

function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.height
scrollit()
}

function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
settimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marqueeheight
scrollit()
}
}

window.onload=regenerate2
</script>

<script language="javascript1.2"><!-- begin
var no = 20; // snow number
var speed = 10; // smaller number moves the snow faster
var snowflake = "pic/meihua.gif";

var ns4up = (document.layers) ? 1 : 0;// browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp;    // coordinate and position variables
var am, stx, sty;// amplitude and step variables
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerwidth;
doc_height = self.innerheight;
} else if (ie4up) {
doc_width = document.body.clientwidth;
doc_height = document.body.clientheight;
}
dx = new array();
xp = new array();
yp = new array();
am = new array();
stx = new array();
sty = new array();
for (i = 0; i < no; ++ i) {
dx = 0;                        // set coordinate variables
xp = math.random()*(doc_width-50);// set position variables
yp = math.random()*doc_height;
am = math.random()*20;         // set amplitude variables
stx = 0.02 + math.random()/10; // set step variables
sty = 0.7 + math.random();   // set step variables
if (ns4up) {                      // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\">http://code.ik8.com/html/\</layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\">http://code.ik8.com/html/\</layer>");
   }
} else if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><img src=\"" + snowflake + "\" border=\"0\">http://code.ik8.com/html/\</div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: "+ i +"; visibility: visible; top: 15px; left: 15px;\"><img src=\"" + snowflake + "\" border=\"0\">http://code.ik8.com/html/\</div>");
      }
   }
}
function snowns() {// netscape main animation function

for (i = 0; i < no; ++ i) {// iterate for every dot
yp += sty;
if (yp > doc_height-50) {
xp = math.random()*(doc_width-am-30);
yp = 0;
stx = 0.02 + math.random()/10;
sty = 0.7 + math.random();
doc_width = self.innerwidth;
doc_height = self.innerheight;
}
dx += stx;
document.layers["dot"+i].top = yp;
document.layers["dot"+i].left = xp + am*math.sin(dx);
}
settimeout("snowns()", speed);
}

function snowie() {// ie main animation function
for (i = 0; i < no; ++ i) {// iterate for every dot
yp += sty;
if (yp > doc_height-50) {
xp = math.random()*(doc_width-am-30);
yp = 0;
stx = 0.02 + math.random()/10;
sty = 0.7 + math.random();
doc_width = document.body.clientwidth;
doc_height = document.body.clientheight;
}
dx += stx;
document.all["dot"+i].style.pixeltop = yp;
document.all["dot"+i].style.pixelleft = xp + am*math.sin(dx);
}
settimeout("snowie()", speed);
}
if (ns4up) {
snowns();
} else if (ie4up) {
snowie();
}
// end -->
</script>
      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***综合类***结合的很酷的文本滚动与网页飞花的特效!!