Skip to content
Permalink
8c5f4bbdea
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
28 lines (28 sloc) 702 Bytes
function $(id)
{
return document.getElementById(id);
}
function insert(f, e, id)
{
var scroll = $(id).scrollTop;
if(document.selection)
{
$(id).focus();
sel = document.selection.createRange();
sel.text = f+sel.text+e;
}
else if($(id).selectionStart || $(id).selectionStart == '0')
{
var startPos = $(id).selectionStart;
var endPos = $(id).selectionEnd;
$(id).value = $(id).value.substring(0, startPos)+f+$(id).value.substring(startPos, endPos)+e+$(id).value.substring(endPos, $(id).value.length);
$(id).selectionStart = startPos+f.length;
$(id).selectionEnd = startPos+f.length+(endPos-startPos);
}
else
{
$(id).value += msg;
}
$(id).scrollTop = scroll;
$(id).focus();
}