<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<script language="javascript"> 
// JScript source code 
function mo() { 
    var x = event.clientX, y = event.clientY;  //定义返回事件发生时,mouse相对于客户窗口的X,Y坐标 
    //alert(ccc.offsetHeight+","+ccc.style.marginBottom); 
    if (document.getElementById && !document.all) obj = document.getElementById("sh");  //解释下 
    if (document.all) obj = document.all.sh;    //解释下 
    if (document.layers) obj = document.layers.sh;  //解释下 
    if (obj.style.visibility == 'hidden') {    //如果块级元素的visibility属性为hidden则执行以下操作
        var width = 10; 
        var height = 20; 
        obj.style.left = x + 'px';  // 置元素的左边缘距离父元素左边缘的左边距离为Xpx
        obj.style.top = y + 'px';  //设置元素的顶边缘距离父元素顶边缘的之上距离为Ypx
        obj.style.visibility = 'visible';  //将块级元素的visibility从hidden变为visible
        var timer = setInterval(function() {    //每秒钟执行一次以下方法 
            width = width + 10; 
            height = height + 20; 
            if (height < 200) { 
                obj.style.width = width + 'px'; 
                obj.style.height = height + 'px'; 
            } 
            else { 
                clearInterval(timer); obj.innerHTML = '华夏中文社区欢迎你的到来,谢谢支持'; 
            }  
        }, 1); 
    } 
    else { 
        var width = 100; 
        var height = 200; 
        obj.innerHTML = ''; 
        var timer = setInterval(function() { 
            width = width - 10; 
            height = height - 20; 
            if (height > 0) { 
                obj.style.width = width + 'px'; 
                obj.style.height = height + 'px'; 
            } 
            else { clearInterval(timer); obj.style.visibility = 'hidden'; } 
        }, 1); 
    } 
} <body> 
<div id="sh" style="left:500px;border:solid 1px black; top:300px; width:200px; height:50px; position:absolute; visibility:hidden; filter: progid:DXImageTransform.Microsoft.Shadow (Color=#333333,Direction=130,strength=2) alpha(opacity=50) BlendTrans(duration=1); border:solid #999999 1px;z-index:1">//设置块级元素,具体里面的属性可以去百度一个个查
</div> 
<table width="250" border="0" cellspacing="0" cellpadding="0" id="ccc"> 
  <tr> 
    <td height="25"> <a href="http://www.hxzw.net" target="_blank" onmouseover="mo()" onmouseout="mo()">http://www.hxzw.net </a> </td> 
  </tr> 
</table> 
</body> 
</html>

解决方案 »

  1.   

    if (document.getElementById && !document.all) obj = document.getElementById("sh");  //if中的条件符合则把document.getElementById("sh")赋给obj     
    if (document.all) obj = document.all.sh;    //如上
    if (document.layers) obj = document.layers.sh;  //如上document.all 是微软的东西,只被IE4.0支持,document.getElementById 是公共标准,被目前的所有主流浏览器支持,document.layers是支持Netscape,他们的意思都是和document.getElementById一样的
      

  2.   

    if (document.getElementById && !document.all) obj = document.getElementById("sh");  //判断浏览器,FF是W3C 所以是document.getElementById,document.all是IE特有
        if (document.all) obj = document.all.sh;    //如果是IE内核(8。0版前)就找到SH对象并用OBJ对象指向他。
        if (document.layers) obj = document.layers.sh;  //同理