擎天Lv54   
快捷输入     
<!doctype html>
<html>
<head>
<title>点击按钮插入文字</title>
<script language="javascript">
    //移动光标到最后
    var setPos=function(o){
        if(o.setSelectionRange){//W3C
            setTimeout(function(){
                o.setSelectionRange(o.value.length,o.value.length);
                o.focus();
            },0);
        }else if(o.createTextRange){//IE
            var textRange=o.createTextRange();
            textRange.moveStart("character",o.value.length);
            textRange.moveEnd("character",0);
            textRange.select();
        }
    };
function Insert(str) { 
var obj = document.getElementById('content'); 
setPos(obj);
if(document.selection) { 
obj.focus(); 
var sel=document.selection.createRange(); 
document.selection.empty(); 
sel.text = str; 
} else { 
var prefix, main, suffix; 
prefix = obj.value.substring(0, obj.selectionStart); 
main = obj.value.substring(obj.selectionStart, obj.selectionEnd); 
suffix = obj.value.substring(obj.selectionEnd); 
obj.value = prefix + str + suffix; 
} 
obj.focus(); 
}         

</script>
</head>
<body>
    <table width="630" height="55" border="0" cellpadding="0" cellspacing="0">
        <tr><td>
          
            <label>
              <textarea id="content" name="textarea" style="width:500px; height:120px;"></textarea>
        </label>
      
          </td></tr>
  <tr>
    <td width="567" align="left" >
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('急')" value="急 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('发')" value="发 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('求')" value="求 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('回')" value="回 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('货')" value="货 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('至')" value="至 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('车')" value="车 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('到')" value="到 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('要')" value="要 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('在')" value="在 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('剩')" value="剩 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('空')" value="空 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('装')" value="装 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('占')" value="占 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('或')" value="或 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('节')" value="节 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('大')" value="大 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('小')" value="小 " /> 
        <input  type="button" style="cursor:hand" onclick="javascript:Insert('卸')" value="卸 " /> 
   
</td>
  </tr>
</table>
</body>
</html>

 1  已被阅读了1040次  楼主 2020-03-18 02:49:52
回复列表
Powered by HadSky 7.7.10
© 2015-2021 擎天论坛
您的IP:3.236.117.38,2021-06-22 16:28:18,Processed in 0.39139 second(s).
Powered by HadSky
已有0次打赏




免责声明
1、本帖所有言论和图片属于发帖人个人意见,与本论坛立场无关;
2、本贴由该帖子作者发表,该帖子作者与擎天论坛享有帖子相关版权;
3、其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和擎天论坛的同意;
4、帖子作者须承担一切因本文发表而直接或间接导致的民事或刑事法律责任;
5、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责;
6、如本帖侵犯到任何版权问题,请告知本站,本站将及时删除并致以最深的歉意;
7、擎天论坛管理员和版主有权不事先通知发贴者而删除本文。
8、帖子内容如果包含各种违法、违规、欺诈、无效等问题,
点我举报

侵删:admin@qtxml.cn
快捷回复