您的位置:首页 > Web前端 > JavaScript

One Javascript Demo

2010-01-04 13:30 288 查看


<div id="a1" style=" position:absolute; z-index:2;"></div>

<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="白羊.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'白羊.jpg','白羊座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="金牛.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'金牛.jpg','金牛座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="双子.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'双子.jpg','金牛座~')" onmouseout="hide(this)" /></td>
</tr>
<tr></tr>
<tr>
<td><img src="巨蟹.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'巨蟹.jpg','巨蟹座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="狮子.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'狮子.jpg','狮子座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="处女.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'处女.jpg','处女座~')" onmouseout="hide(this)" /></td>
</tr>
<tr></tr>
<tr>
<td><img src="天秤.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'天秤.jpg','天秤座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="天蝎.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'天蝎.jpg','天蝎座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="射手.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'射手.jpg','射手座~')" onmouseout="hide(this)" /></td>
</tr>
<tr></tr>
<tr>
<td><img src="摩羯.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'摩羯.jpg','摩羯座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="水瓶.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'水瓶.jpg','水瓶座~')" onmouseout="hide(this)" /></td>
<td></td>
<td></td>
<td></td>
<td><img src="双鱼.jpg" alt="hi.baidu.com/liwya" onmousemove="show(event,'双鱼.jpg','双鱼座~')" onmouseout="hide(this)" /></td>
</tr>
</table>

<script>
function show(event,_this,mess) {
event = event || window.event;
var t1="<table cellspacing='1' cellpadding='10' style='border-color:#CCCCCC;background-color:#FFFFFF;font-size:12px;border-style:solid; border-width:thin;text-align:center;'><tr><td><img src='" + _this + "' width='300' height='225' > <br>"+mess+"</td></tr></table>";
document.getElementById("a1").innerHTML =t1;
//document.getElementById("a1").innerHTML = "<img src='" + _this.src + "' >";
document.getElementById("a1").style.top = document.body.scrollTop + event.clientY + 10 + "px";
document.getElementById("a1").style.left = document.body.scrollLeft + event.clientX + 10 + "px";
document.getElementById("a1").style.display = "block";
}
function hide(_this) {
document.getElementById("a1").innerHTML = "";
document.getElementById("a1").style.display = "none";
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: