- 爱易网页
 
                        - 
                            JavaSript
 
                        - Javascript擒获鼠标位置(跨浏览器) 
 
                         
                    
                    
                    日期:2014-05-16  浏览次数:20492 次 
                    
                        
                         Javascript捕获鼠标位置(跨浏览器)
    
- 
Javascript获取鼠标位置,显示Memo,相当于Alt和Title属性,但是要比Alt和Title拉风啊??
 
- 
??
 
- 
??
 
- 
<
html
>
??
 
- 
????<
head
>
??
 
- 
????????<
script
?
type
=
"text/javascript"
>
??
 
- 
????????????function?showMemo(evt,data)?{??
 
- 
????????????????//alert(evt.clientX);??
 
- 
????????????????document.getElementById.('memo').style.left
?=?
evt
.clientX;??
 
- 
????????????????document.getElementById.('memo').style.top
?=?
evt
.clientY;??
 
- 
????????????????document.getElementById.('memo').innerHTML
?=?
data
;??
 
- 
????????????????document.getElementById.('memo').style.display
?=?
'block'
;??
 
- 
????????????}??
 
- 
????????????function?hideMemo()?{??
 
- 
????????????????document.getElementById.('memo').style.display
?=?
'none'
;??
 
- 
????????????}??
 
- 
????????</
script
>
??
 
- 
????</
head
>
??
 
- 
????<
body
>
??
 
- 
????????<
table
>
??
 
- 
????????????<
tr
>
??
 
- 
????????????????<
td
?
onmouseover
="showMemo(event,'Memo1');"
onmouseout
="hideMemo();"
>
aaa
</
td
>
??
 
- 
????????????????<
td
?
onmouseover
="showMemo(event,'大家好,我是Memo2!!!');"
onmouseout
="hideMemo();"
>
aaa
</
td
>
??
 
- 
????????????????<
td
?
onmouseover
="showMemo(event,'大家好,我是Memo3!!!');"
onmouseout
="hideMemo();"
>
aaa
<
                        
                    
 
 
                    
                    
                        免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。