javascript在鼠标位置获取文本

时间:2010-04-28 13:37:40

标签: javascript onmousemove

如何在鼠标位置获取文字? 我现在有一些这样的

document.body.onmousemove = function(){
    //todo:Get text at mouse position
}

1 个答案:

答案 0 :(得分:1)

One way of doing so is using [PrototypeJs][1]

Try this one let me know if there is any problem

$(document.body).observe('click', respondToClick);

function respondToClick(event) {
  var element = event.element();
  var source = element.innerHTML;
}