js行背景变色、显示提示层的代码

来源:互联网 发布:css modules css in js 编辑:程序博客网 时间:2024/05/22 14:56

//保存为一个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)"