用HTML做网页怎样添加漂浮物

用HTML做网页怎样添加漂浮物,第1张

用javascript代码编写,你去网上搜,有现成的代码,下面给你一段:漫天飞舞的泡泡

<body>

<script language="JavaScript">

<!--

var no = 30//泡泡的数量

var speed = 1

var ns4up = (document.layers) ? 1 : 0

var ie4up = (document.all) ? 1 : 0

var s, x, y, sn, cs

var a, r, cx, cy

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

}

x = new Array()

y = new Array()

r = new Array()

cx = new Array()

cy = new Array()

s = 8

for (i = 0i <no++ i) {

initRain()

if (ns4up) {

if (i == 0) {

//以下有些是对泡泡的颜色及泡泡符号的设置,○改为别的,那么往下掉的就不是泡泡了

document.write("<layer name=\"dot"+ i +"\" left=\"1\" ")

document.write("top=\"1\" visibility=\"show\"><font color=\"#99CCFF\">")

document.write("○</font></layer>")

}

else {

document.write("<layer name=\"dot"+ i +"\" left=\"1\" ")

document.write("top=\"1\" visibility=\"show\"><font color=\"#99CCFF\">")

document.write("○</font></layer>")

}

}

else

if (ie4up) {

if (i == 0) {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ")

document.write("absoluteZ-INDEX: "+ i +"VISIBILITY: ")

document.write("visibleTOP: 15pxLEFT: 15px\"><font color=\"#99CCFF\">")

document.write("○</font></div>")

}

else {

document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ")

document.write("absoluteZ-INDEX: "+ i +"VISIBILITY: ")

document.write("visibleTOP: 12pxLEFT: 12px\"><font color=\"#99CCFF\">")

document.write("○</font></div>")

}

}

}

function initRain() {

a = 6

r[i] = 1

sn = Math.sin(a)

cs = Math.cos(a)

cx[i] = Math.random() * doc_width + 1

cy[i] = Math.random() * doc_height + 1

x[i] = r[i] * sn + cx[i]

y[i] = cy[i]

}

function makeRain() {

r[i] = 1

cx[i] = Math.random() * doc_width + 1

cy[i] = 1

x[i] = r[i] * sn + cx[i]

y[i] = r[i] * cs + cy[i]

}

function updateRain() {

r[i] += s

x[i] = r[i] * sn + cx[i]

y[i] = r[i] * cs + cy[i]

}

function raindropNS() {

for (i = 0i <no++ i) {

updateRain()

if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {

makeRain()

doc_width = self.innerWidth

doc_height = self.innerHeight

}

document.layers["dot"+i].top = y[i]

document.layers["dot"+i].left = x[i]

}

setTimeout("raindropNS()", speed)

}

function raindropIE() {

for (i = 0i <no++ i) {

updateRain()

if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {

makeRain()

doc_width = document.body.clientWidth

doc_height = document.body.clientHeight

}

document.all["dot"+i].style.pixelTop = y[i]

document.all["dot"+i].style.pixelLeft = x[i]

}

setTimeout("raindropIE()", speed)

}

if (ns4up) {

raindropNS()

}

else

if (ie4up) {

raindropIE()

}

-->

</script>

</body>

我说的是dw方法:

点到你要插入flash的地方-点菜单栏里的“插入记录”-媒体-flash

然后在设定大小,

要想好看些可以把它变成透明的代码如下:

<param name="wmode" value="transparent">

你可以参考一下这个例子:http://www.jq22.com/demo/jquery-xuehua-141226231146/

这个是雪花飘落的。从上往下票,蒲公英是左右飘,你稍微变通一下即可。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11616409.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存