------- тестовый код (test.html) ------------
<!DOCTYPE html>
<html>
<head>
<style>
*{padding:0px;margin:0px;}
</style>
</head>
<body style="background-color:orange;">
<b onmousemove="tip(this);">A</b> <b>B</b> <b>C</b><!--tip:when mouse is at here the same trigger the function tip()//-->
<fieldset>
<legend id="mouseDot" style="display:block;background-color:red;height:5px;width:200px;"></legend>
<div style="background-color:white;" id="tipTxt">onload mouseDot(red line) width=200px</div>
</fieldset>
<script>
function tip(tag) {
mouseDot.style.width = event.x + 'px';
tipTxt.innerHTML = 'mouse is move at x=' + event.x + ';so mouseDot(red line) width= ' + event.x + 'px';
}
</script>
</body>
</html>
Тестовая среда IE 9 (режим просмотралюбой, но режим документа IE 8 );
когда ваша мышь перемещается в A
, она может вызвать function tip()
, это нормально; но когда двигаетесь на <!--tip:when mouse is at here the same trigger the function tip()//-->
, почему он тоже звонит function tip()
?
Вы можете увидеть, что происходит на моем блоге с некоторыми скриншотами: http://hi.baidu.com/qidizi/blog/item/2322e1f7335b074e342acc46.html
Совет: Сообщение в блоге было изменено, оно должно быть более четким
, почему A
может перейти на <!--tip:when mouse is at here the same trigger the function tip()//-->
, только 3 размера пикселя,реагирует только на события мыши, нажатие на событие недействительно?