XSLT存档  

不及格的程序员-八神

 查看分类:  ASP.NET XML/XSLT JavaScripT   我的MSN空间Blog
<script>
                                    jQuery.fn.setCursorPosition = function(position)
                                    { 
                                    if(this.lengh == 0) 
                                        return this; 
                                    return $(this).setSelection(position, position); 
                                    } 
                                    jQuery.fn.setSelection = function(selectionStart, selectionEnd)
                                    { 
                                        if(this.lengh == 0) return this; 
                                        input = this[0]; 
                                        if (input.createTextRange) 
                                        { 
                                            var range = input.createTextRange();
                                             range.collapse(true); 
                                            range.moveEnd('character', selectionEnd); 
                                            range.moveStart('character', selectionStart); 
                                            range.select(); 
                                         } 
                                        else if (input.setSelectionRange)
                                        {
                                            input.focus(); input.setSelectionRange(selectionStart, selectionEnd);
                                        } 
                                        return this;
                                    } 
                                    jQuery.fn.focusEnd = function(){ this.setCursorPosition(this.val().length); }
                                    jQuery("#listBoxWageItem").click(function (e)
                                    {
                                        if (jQuery.trim(jQuery(this).find("option:selected").text()) != "")
                                        {
                                            jQuery("#txtFormula").val(jQuery("#txtFormula").val() + "[" + jQuery.trim(jQuery(this).find("option:selected").text()) + "]").focusEnd();                                            
                                        }
                                    });
                                </script>

 

posted on 2018-05-10 16:23  不及格的程序员-八神  阅读(19)  评论(0编辑  收藏  举报