2014年3月25日

js获取文本框(或文本域)光标位置以及设置光标位置

摘要: varcursor={/*获取文本框(或文本域)光标位置ele:文本框(或文本域)*/getCursorPosition:function(element){varpos=0;if(document.selection){/*IE*/element.focus();varrange=document.selection.createRange();range.moveStart("character",-form1.txt.value.length);pos=range.text.length;}elseif(element.selectionStart){pos=elem 阅读全文

posted @ 2014-03-25 17:13 yuanxiaowa 阅读(1500) 评论(0) 推荐(0)

导航