//保存为一个js文件,引入使用就行了
function showHelp(id) { var obj = document.getElementById(id); obj.style.display = ""; obj.style.left = event.x; obj.style.top = event.y; } function hideHelp(id) { var obj = document.getElementById(id); obj.style.display = "none"; } //<div id="tooltip1" style="position:absolute;display:none; z-index: 1000; border: solid 1px black;padding: 10px; background: white;">提示</div> // onmouseover="showHelp('tooltip1');" onmouseout="hideHelp('tooltip1');" var c; function cc(obj) { c = obj.style.backgroundColor; obj.style.backgroundColor = '#E7EDFE' } function cc1(obj) { obj.style.backgroundColor = c; } // onmouseover="cc(this)" onmouseout="cc1(this)"