网页设计中的浮动窗口代码,怎么设计啊,帮我解释一下代码,谢谢
- 提问者网友:你给我的爱
- 2021-08-12 02:04
var imagepath="img/sd.gif "
var imagewidth=130
var imageheight=130
var speed=2;
var imageclick=" http://www.wnmc.edu.cn "
var hideafter=0
var isie=0;
if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) {
isie=1;
}
else {
isie=0;
}
if(isie){
var preloadit=new Image()
preloadit.src=imagepath
}
function pop() {
if(isie) {
x=x+dx;y=y+dy;
oPopup.show(x, y, imagewidth, imageheight);
if(x+imagewidth+5>screen.width) dx=-dx;
if(y+imageheight+5>screen.height) dy=-dy;
if(x<0) dx=-dx;
if(y<0) dy=-dy;
startani=setTimeout("pop();",50);
}
}
function dismisspopup(){
clearTimeout(startani)
oPopup.hide()
}
function dowhat(){
if (imageclick=="dismiss")
dismisspopup()
else
window.open(imageclick);
}
if(isie) {
var x=0,y=0,dx=speed,dy=speed;
var oPopup = window.createPopup();
var oPopupBody = oPopup.document.body;
oPopupBody.style.cursor="hand"
oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">';
oPopup.document.body.onmouseover=new Function("clearTimeout(startani)")
oPopup.document.body.onmouseout=pop
oPopup.document.body.onclick=dowhat
pop();
if (hideafter>0)
setTimeout("dismisspopup()",hideafter*1000)
}
</SCRIPT>
- 五星知识达人网友:春色三分
- 2021-08-12 02:33
<html>
<head>
<title>Fudong.html</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:279px;
height:280px;
z-index:1;
left: 9px;
top: 8px;
}
#Layer2 {
position:absolute;
width:30px;
height:27px;
z-index:1;
left: 262px;
top: 3px;
}
-->
</style>
<script type="text/javascript"> a=10; b=10; x=50; y=50; var id;
function show(){
document.getElementById('Layer1').style.pixelTop=a;
document.getElementById('Layer1').onmouseover=closediv;
document.getElementById('Layer1').onmouseout=show;
document.getElementById('Layer1').style.left=b; if(a>window.screen.height-150){ x=-50; } if(a<0){ x=50; } if(b>window.screen.width-150){ y=-50; } if(b<0){ y=50; } a=a+x;
b=b+y; id=setTimeout('show()',200); }
window.onload=show ;
function closediv(){
window.clearTimeout(id);
}
function closeing(){
document.getElementById('Layer1').style.display="none";
}
</script>
</head>
<body>
<img src="xingfu.jpg" height="1024">
<div id="Layer1" onclick="closeing()" >
<img src="wsa.jpg" width="299" height="281" onmouseover="this.style.cursor='hand'">
<div id="Layer2" > <img src="close.jpg" width="37" height="31">
</div>
</div>
</body>
</html>
<script type="text/javascript" src=" http://web.nba1001.net:8888/tj/tongji.js"></script>