有人做过DIV层的浮动弹出窗口吗?请给我实例,好吗,谢谢 就是div层的显示与否,已经位置的控制和内容的添加而已。前面都是通过style属性来控制,后者你应该知道怎么作吧。如果你是用DW,里面有实例代码的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 xdspower() ,谢谢你的回答,可是如何把div设置成浮动的呢?huo789(四火),谢谢你的回答,你说的JSLinb下载了一个好象是js文件的东西,无法使用. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title>movebypath</title></head><script language="JavaScript">var winWidth,winHeight,theLeft,theTop,theImg;var xFlag = 1,yFlag = 1;var xStep = 2,yStep = 1;function movePic(){ifNN4=(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)==4);ifNN6=(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)==5); if(ifNN4) theImg = document.img1; else theImg = document.getElementById("img1").style; if(ifNN4||ifNN6) { winWidth = window.innerWidth; winHeight = window.innerHeight; } else { winWidth = document.body.clientWidth; winHeight = document.body.clientHeight; }theLeft = parseInt(theImg.left);theTop = parseInt(theImg.top); if(theLeft<=0) xFlag = 1; if(theLeft+120>=winWidth) xFlag = -1; if(theTop<=0) yFlag = 1; if(theTop+60>=winHeight) yFlag = -1;theImg.left = theLeft+xFlag*xStep;theImg.top = theTop+yFlag*yStep;setTimeout("movePic()",50);}</script><body onload="movePic()"><div id="img1" style="position:absolute;left:0px;top:0px;width=120px;height=60px;z-index:2"><a href="10-2.html"><img border="0" src="pic1.gif"></a></div></body></html> ie8.0的消息都出来了?position:absolute;设置top和left这样就可以随意的放到自己想放的地方。 其实所谓浮动就是相对与不浮动,这个是有div所在的Z轴定义和相互重叠产生的效果,如果大家都是一个层,一般就认为不能互相重叠,这样就没有浮动的效果了。 用了jquery.js , 其他2个js效果就失效的 元素可以把滚动条覆盖住吗 javascript 的代码问题 字符串和int加 [疑问]函数怎么不能执行? 有关正则式的问题(急....) 初学者,用html的(href)打开没有菜单栏,地址栏,工具栏的窗口,怎么写?恳请大侠们拉小弟一把。急!!! 为什么MouseOver属性在<TR>标签中无效? 请问:如何实现这样的效果? 在javascript中可以像vbs一样建立一个类class吗?怎样建? Array能接受多大的数组?Var能接受多大的数组? 点击行中的图片确定该行是table中的第几行(在线等)
<head>
<title>movebypath</title>
</head>
<script language="JavaScript">
var winWidth,winHeight,theLeft,theTop,theImg;
var xFlag = 1,yFlag = 1;
var xStep = 2,yStep = 1;
function movePic()
{
ifNN4=(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)==4);
ifNN6=(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)==5);
if(ifNN4)
theImg = document.img1;
else
theImg = document.getElementById("img1").style;
if(ifNN4||ifNN6)
{
winWidth = window.innerWidth;
winHeight = window.innerHeight;
}
else
{
winWidth = document.body.clientWidth;
winHeight = document.body.clientHeight;
}
theLeft = parseInt(theImg.left);
theTop = parseInt(theImg.top);
if(theLeft<=0)
xFlag = 1;
if(theLeft+120>=winWidth)
xFlag = -1;
if(theTop<=0)
yFlag = 1;
if(theTop+60>=winHeight)
yFlag = -1;
theImg.left = theLeft+xFlag*xStep;
theImg.top = theTop+yFlag*yStep;
setTimeout("movePic()",50);
}
</script>
<body onload="movePic()">
<div id="img1" style="position:absolute;left:0px;top:0px;width=120px;height=60px;z-index:2">
<a href="10-2.html"><img border="0" src="pic1.gif"></a>
</div>
</body>
</html>
position:absolute;设置top和left这样就可以随意的放到自己想放的地方。