Author: Unknown
•20:19
今天做一个输入框的时候需要用到在光标处插入问题,觉的这样设计比较人性化,代码如下:

function Insert(str,name)
{
document.getElementById(name).focus();
var r = document.selection.createRange();
document.selection.empty();
r.text = str;
}

感觉javascript确实很强大,还有很多地方要学习!
努力努力!!
This entry was posted on 20:19 and is filed under . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

0 评论: