日期:2014-05-16 浏览次数:20362 次
jquery-numberformatter
http://code.google.com/p/jquery-numberformatter/
$("#salary").blur(function(){ ? ?$(this).parseNumber({format:"#,###.00", locale:"us"}); ? ?$(this).formatNumber({format:"#,###.00", locale:"us"}); });
?
jshashtable
http://www.timdown.co.uk/jshashtable/
?
页面元素在窗口的中间位置
var winWidth = $(window).width(); var winHeight = $(window).height(); var x = (winWidth - 382)/2 + $(document).scrollLeft(); var y = (winHeight - 280)/2 + $(document).scrollTop();
?
时间区转换
?
function calcTime(city, offset) { d = new Date(); utc = d.getTime() + (d.getTimezoneOffset() * 60000); nd = new Date(utc + (3600000*offset)); return "The local time in " + city + " is " + nd.toLocaleString(); } alert(calcTime('Bombay', +5.5)); alert(calcTime('Singapore', +8)); alert(calcTime('London', +1));?
把文本框焦点移动到文本最后
function setInputFocus(elementId){ var inputElement = document.getElementById(elementId); if(!inputElement){ return; } var textRange =inputElement.createTextRange(); textRange.moveStart('character',inputElement.value.length); textRange.collapse(true); textRange.select(); }