浮动层的制作

今天终于连抄带蒙把人家鼠标移过某个区域时,显示浮动框文字的代码给整了过来:

首先:

<script language="JavaScript1.2">

function MM_findObj(n, d) {

  var p,i,x;

  if(!d) d=document;

  if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document;

    n=n.substring(0,p);

  }

  if(!(x=d[n])&&d.all) x=d.all[n];

  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)

    x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n);

  return window.hintDiv;

 

}

 

function MM_setTextOfLayer(objName,x,newText) {

  newText = "<TABLE WIDTH=100% BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=/"#456972/"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD ALIGN = /"CENTER/" BGCOLOR=/"#FFFFFF/"><FONT FACE=/"宋体/" COLOR=/"# 8A 2BE2/">"+newText+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"

  if ((obj=MM_findObj(objName))!=null) with (obj)

 

    if (document.layers) {

      document.write(unescape(newText));

      document.close();

    }

    else innerHTML = unescape(newText);

}

 

function MM_showHideLayers() {

  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}

 

function MM_changeProp(objName,x,theProp,theValue) { //v6.0

  var obj = MM_findObj(objName);

  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){

    if (theValue == true || theValue == false)

      eval("obj."+theProp+"="+theValue);

    else eval("obj."+theProp+"='"+theValue+"'");

  }

}

 

//-->

</script>

然后在页面上加入层:

<DIV id=hintDiv style="POSITION: absolute; Z-INDEX: 0; left: 0px; top: 17px; width: 500px; height: 100px;visibility: hidden;" ></DIV>

最后,在调用的地方写:

  <TR onMouseOver=" MM_setTextOfLayer('overDiv','','<%=strShowText%>');MM_showHideLayers('overDiv','','show');

                            MM_changeProp('overDiv','','style.left',0,'DIV');MM_changeProp('overDiv','','style.top',window.event.y+10,'DIV');

                            MM_changeProp('overDiv','','style.width',<%=intLength%>*13,'DIV');" onMouseOut=" MM_showHideLayers('overDiv','','hide');">

此事多仗胡兄相助,小女子在此敛衽为礼,聊表谢意!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值