js 文本框插入 function insertAtCaret(textbox,text) { textbox.focus(); document.selection.createRange().text = text; } function inputCalc(str){ addText(document.getElementById("CalcuteText"),str); } /* function addText2(oTextarea,strText){ oTextarea.focus(); document.selection.createRange().text+=strText; oTextarea.blur(); } */ //在光标位置插入文本 function addText(oTextarea,strText){ //clipboardData.setData("text",strText); oTextarea.focus(); //document.execCommand("paste"); //oTextarea.focus(); document.selection.createRange().text = strText; }[@more@]
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11419868/viewspace-1013255/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11419868/viewspace-1013255/