<script type="text/javascript">
$(function(){
var input = $('input[type=text]');
var items = ["mousedown", "mouseup"];
for (var i = 0; i < items.length; i++){
(function(){
var item = items[i];
input[item](function(e){
calculate(e);
return false;
});
})();
}
});
</script>
<input readonly="readonly" type="text" value="first.second.third" />