站内搜索: 请输入搜索关键词

当前页面: JAVA 编程资料牛鼻论坛AJAX & JavaScript 技术→怎么增加网页挂件

怎么增加网页挂件

发表新主题   回复此主题

第1楼 2006-09-10 19:33 yishan5202000 写道:

怎么增加网页挂件


常可以在网页上看到一些悬浮的可爱小挂件,那是怎么加上去的呢?去哪里找这些挂件呢?还有那些把鼠标变成别的小玩意是怎么弄的呢?能具体说说怎么操作呢?我打算弄在中国博客我的博客上.

第2楼 2013-08-31 12:44 Robot :

怎么增加网页挂件 相关


第3楼 2006-09-10 20:26 yishan5202000 写道:

把下面的文件保存为CSS样式表,然后再加到你的网页中去:
body {cursor: url('cursors/body.ani');}
其中两个单引号之间的是你自定义光标的文件路径。

把下面的文件保存为网页,其中图片的文件名是float.gif:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>飘动图片</title>
</head>
<body>
<div id="img" style="position: absolute; z-index: 2; left: 100; top: 126; width: 100; height: 75">
<img src="float.gif" width="100" height="75"></div>
<script language=javascript>
<!-- Begin
var xPos = 200;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 20;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function start() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
// End -->
</script>
</body>
</html>


发表新主题   回复此主题