得到文本框选中的文字,动态插入文字的js代码_表单特效
            
                    来源:动视网
                                        责编:小采
                                        时间:2020-11-27 20:35:58
                    
            
            
                         
                
                
                    得到文本框选中的文字,动态插入文字的js代码_表单特效
                    得到文本框选中的文字,动态插入文字的js代码_表单特效: 代码如下: function AppTag(tagcode) {  document.PostMessage.Message.value += tagcode; } function InsertTag(tagbegin,tagend) {  if ((document.selection)&&(document.selection.type == 
                    
                 
                
             
                        导读得到文本框选中的文字,动态插入文字的js代码_表单特效: 代码如下: function AppTag(tagcode) {  document.PostMessage.Message.value += tagcode; } function InsertTag(tagbegin,tagend) {  if ((document.selection)&&(document.selection.type == 
                        
            
 代码如下:
 script> 
function AppTag(tagcode) 
{ 
 document.PostMessage.Message.value += tagcode; 
} 
function InsertTag(tagbegin,tagend) 
{ 
 if ((document.selection)&&(document.selection.type == "Text")) { 
 var range = document.selection.createRange(); 
 var ch_text=range.text; 
 range.text = tagbegin + ch_text + tagend; 
 } 
 else 
 { 
 document.PostMessage.Message.value=tagbegin+document.PostMessage.Message.value+tagend; 
 document.PostMessage.Message.focus(); 
 } 
} 
 script> 
 
调用: 
执行操作的图标按钮: 
 
 
 
 
其中[ImgFace1],[B],[/B]为要插入的文字 
 var range = document.selection.createRange(); 
 var ch_text=range.text; 
这是得到文本框选中的文字 
被操作的文本框: 
 
    
    
        得到文本框选中的文字,动态插入文字的js代码_表单特效
        得到文本框选中的文字,动态插入文字的js代码_表单特效: 代码如下: function AppTag(tagcode) {  document.PostMessage.Message.value += tagcode; } function InsertTag(tagbegin,tagend) {  if ((document.selection)&&(document.selection.type ==