2012年11月30日

获取光标位置

摘要: 在项目开发中经常遇到input等设置光标位置到最后的问题,今天我查了一下Google,找到了在IE、Firefox、Opera等主流浏览器的获取光标位置(getCursortPosition)以及设置光标位置(setCursorPosition)的函数。function getCursortPosition (ctrl) {//获取光标位置函数var CaretPos = 0;// IE Supportif (document.selection) {ctrl.focus ();var Sel = document.selection.createRange();Sel.moveStart(& 阅读全文

posted @ 2012-11-30 15:46 TonyCoolZhu 阅读(386) 评论(0) 推荐(0) 编辑

导航