鼠標移到控件上方提示幫助信息

来源:互联网 发布:魏宁海天地人指标源码 编辑:程序博客网 时间:2024/05/29 12:34

1、創建一個*.js文件包含以下信息 

//鼠標移到控件上方提示幫助信息
document.write("<div id=HelpMessageLayer style='border-right: #000000 1px ridge; border-top: #000000 1px ridge; border-left: #000000 1px ridge; color: #000033; border-bottom: #000000 1px ridge; font-family: Arial; font-size:13px; font-style: normal; font-variant: normal; text-decoration: none;background-color:#fff4e6;position: absolute; z-index: 99999999999999; display: none'>help Message!!</div>");

function MessageLayer() //初始化設置
{   
    this.backImage = "";   //url(print.jpg);
    this.backColor = "#FFFFFF";
    this.objExport  = null;
    this.layerOut   = document.all.HelpMessageLayer;  
}  

var MessageLayer = new MessageLayer();

function CSWITHiddenLayer()
{
 MessageLayer.layerOut.style.display = "none";
}

function CSWITHelpMessageInfo() //主調函數
{        
     var e = window.event.srcElement;
    MessageLayer.eventSrc = e;

 var o = MessageLayer.layerOut.style;
 
    MessageLayer.layerOut.innerText= arguments[1];

    if (arguments.length == 0)
    {  
        MessageLayer.objExport = e;
    }
    else
    { 
        MessageLayer.objExport = eval(arguments[0]);
    
    }   

    o.display = "";
   

    o.top=window.event.y+16;
    o.left=window.event.x+5;

  2、在前臺用JavaScript調用

  調用方式如

  <input type="submit" name="btnAdd" value="新增"  id="btnAdd" class="input" WITOwner="true" EnableFlag="0" onmouseover="CSWITGetHelpMessageInfo(this,'新增功能');CSWITURL_OnMouseOver(this,'#000000');" style="width:41px;" />
    o.display = "";
   

    o.top=window.event.y+16;
    o.left=window.event.x+5;

注意:  粗體部分為調用的部分

原创粉丝点击