<script language="javascript" type="text/javascript">
function getCaret(textbox) {
var control = document.activeElement;
textbox.focus();
var rang = document.selection.createRange();
rang.setEndPoint("StartToStart", textbox.createTextRange())
control.focus();
return rang.text.length;
}
function Fun(textbox) {
var index = getCaret(textbox);
var start = index, end = 0;
var str = textbox.value;
for (var i = start; i >= 0; i--) {
if (str[i] == '{') {