求救,告诉我这个网页效果怎么做

来源:百度知道 编辑:UC知道 时间:2024/05/22 18:05:52
http://www.viki.cc/visheji.htm在这网站的左边的案例索引部分,鼠标移到哪个上都会有个小窗口跟随,我想知道怎么做出来,请高手帮忙,分数不是问题,本人初学网页,请说详细,谢谢。

应该是利用鼠标的onmouseon事件,再配合控制div的显示或隐藏来实现的吧。要详细写出来比较麻烦,因为是脚本控制的效果,所以你可以在这个查看它的源代码,能看到的。

rewtq3

主要是通过 onMouseOver 和onMouseOut两个事件控制层的显示与隐藏,
再通过获取鼠标位置来给层定位
下面是它的源码
<script>
//--初始化变量--
// from webjx.com
var rT=false;//允许图像过渡
var bT=false;//允许图像淡入淡出
var tw=150;//提示框宽度
var endaction=false;//结束动画
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
if(ns4||ns6||ie4)
{
if(ns4) toolTipSTYLE = document.toolTipLayer;
else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
if(ns4) document.captureEvents(Event.MOUSEMOVE);
else
{
toolTipSTYLE.visibility = "visible";
toolTipSTYLE.display = "none";
}