이벤트는 IE 및 FF와 호환되지 않습니다. 오늘 나는 전송에 몇 가지 문제가 발생했습니다. 온라인에서 몇 가지 방법을 참조하고 경험이 있습니다.
aclassarray [i] .onmouseover = function () {// 코드를 직접 작성해도 괜찮습니다. 전달할 매개 변수를 전달할 수도 있지만 재사용이 편리하지 않습니다}; aclassarray [i] .onmouseover = linkmouseover // 매개 변수를 전달하지 않고 사용할 수는 있지만 미래의 인수에서 사용할 수는 없지만 [0] aclassarray [i] .onmouseOver = intrinMouseOver () // Putt Brackets [I]. }; // 이것은 전달 될 수 있고 경고 할 수 있지만 EVT.clientX + "PX"에 문제가 있으며 비어 있습니다. . . arguments.callee.caller.arguments [0] // var src = evt.srcelement를 해결하는 데 이것을 사용할 수 있습니다 || evt.target; // SRC도 팔로우 할 수도 있습니다=======================================================================================================
첨부 된 운동 코드
<! docType html> <html> <head> <title> </title> </title> <meta http-equiv = "content-type"content = "text/html; charset = utf-8"/> <link rel = "stylesheet"href = "css/ui-lightness/jikery-ui-1.10.10.4.custom.cs. /> <script src = "js/jquery-1.10.2.js"> </script> <script src = "js/jquery-ui-1.4.4.custom.js"> </script> <style type = "text/css">. aclass, .aclass : infort {36px; #0094ff;}. divtips {font-size : 20px; 컬러 : 빨간색; 테두리 : #f00 1px 고체; 위치 : 절대; 너비; 너비; 너비 : 100px; height : 30px;} </style> <스크립트 유형 = "text/javaScript"> 함수 initonover () {var titletips = { "163": "163": "163": "163": "Baidu" 팁 ","Google ":"Google 웹 사이트 프롬프트 "} var atag = docum 0; i <aclassarray.length; var e; aclassarray [i] .onmouseover ()}; arguments.callee.caller.arguments [0]; // 이벤트 객체 divtips.classname = "divtips"; divtips.style.left = evt.clientx + "px"; // + px 호환 된 ffdivtips.style.top = evt.clienty + "px"; // px ffdivtips.innerhtml = "test"; document.getElementById ( "diva"). AppendChild (divtips);} 함수 linkmouseout () {var divtag = hocept.getElementsByTagName ( "div"); for (var i = 0; i <divtag.length; i ++) {if (if [i] .classname == "divtips"). {document.getElementById ( "diva"). RemoveChild (divtag [i]);}}} window.onload = initonover; </script> </head> <lody> <div id = "diva"> <a href = "http://www.baidu.com"rel = "external nofollow" /> <a href = "http://www.163.com"rel = "external nofollow"> netease </a> <br/> <br/> <br/<br/> <a href = "http://www.google.com"rel = "external nofollow"> google </a> </body> </html>