function test(str) { var tc = document.getElementById("TextBox1"); var tclen = tc.value.length; tc.focus(); if(typeof document.selection != "undefined") { document.selection.createRange().text = str; } else { tc.value = tc.value.substr(0,tc.selectionStart)+str+tc.value.substring(tc.selectionStart,tclen); } }
光标处插入内容
最新推荐文章于 2024-05-11 16:18:09 发布