慕标琳琳
function get_text() {
//你的代码};
(funcgtion() {
var tick = -1;
function addEvent(element, eventType, handler) {
if (element.addEventListener) {
element.addEventListener(eventType, handler);
}
else {
element.attachEvent('on' + eventType, handler);
}
}
var div = document.getElementById('yourDIV');
addEvent(element, 'mouseup', function() {
clearTimeout(tick);
tick = setTimeout(get_text, 2000);
});
addEvent(element, 'mousedown', function() {
clearTimeout(tick);
});
});