小微博1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>腾讯微博</title>
    <script src="JQuery/jquery-1.8.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        //文字选中代码
        $.fn.selectRange = function (start, end) {
            var curObj = $(this).get(0); //获取当前选中
            if (!curObj) return; //非curObj对象,返回.
            else if (curObj.setSelectionRange) { //设置属性.
                curObj.focus(); curObj.setSelectionRange(start, end);
            } /* WebKit */
            else if (curObj.createTextRange) { // 创建TextRange
                var range = curObj.createTextRange();
                range.collapse(true);
                range.moveEnd('character', end);
                range.moveStart('character', start);
                range.select();
            } /* IE */
            else if (curObj.selectionStart) {
                curObj.selectionStart = start;
                curObj.selectionEnd = end;
            }
        };

 

 

 

 

posted @ 2013-08-03 23:48  nqsan  阅读(155)  评论(0编辑  收藏  举报