希特勒传从乞丐到元首:网页制作中这种效果怎样实现?

来源:百度文库 编辑:中科新闻网 时间:2024/04/26 20:19:34
就是一个gif图片,放在网页上,在浏览网页时,鼠标可以随时拖动图片搁在任何位置?

一:修改<body***>中的内容,将下面的代码加入原<body***>中
onload="init()"

二:将下面的代码复制到〈BODY〉与〈/BODY〉中
<SCRIPT language=JavaScript>
drag = 0
move = 0
function init() {
window.document.onmousemove = mouseMove
window.document.onmousedown = mouseDown
window.document.onmouseup = mouseUp
window.document.ondragstart = mouseStop
}
function mouseDown() {
if (drag) {
clickleft = window.event.x - parseInt(dragObj.style.left)
clicktop = window.event.y - parseInt(dragObj.style.top)
dragObj.style.zIndex += 1
move = 1
}
}
function mouseStop() {
window.event.returnValue = false
}
function mouseMove() {
if (move) {
dragObj.style.left = window.event.x - clickleft
dragObj.style.top = window.event.y - clicktop
}
}
function mouseUp() {
move = 0
}
</SCRIPT>
<div id="block1" onmouseout="drag=0" onmouseover="dragObj=block1; drag=1;" style="height: 90; left: 200; position: absolute;

top: 200; width: 90">
<dd>
<!-- 改变下面的图像名称和宽度、高度-->
<img alt border="0" src="015s.jpg" width="140" height="105"> </dd> </div>

有这种特效的软件!
你可以下载一个看看!
有形有色就好像能!
你到网上搜索一下吧!

下载“有声有色”吧

全都是网页特效 有很多
肯定有你想要的

图片特效,哪都有