javascript校驗實例

日誌 > 技術交流
發表於:2008年2月23日 9時48分1秒閱讀(4)評論(0)特效:[信紙]本文鏈接:http://user.qzone.qq.com/592433424/blog/1203731281
javascript校驗實例
function storeCaret(textEl) {
if (textEl.createTextRange) {
  textEl.caretPos = document.selection.createRange().duplicate();
}
}
function submitSearch() {
var key;
key = window.event.keyCode;
if (key == 13) {
  doneExpAdv(frmAdvance);
}
}
functiononInsertRelation(text) {
var strWhrToInsert;
strWhrToInsert = "";
if (strWhrToInsert == 0) {
  onInsertAdvSql(text);
} else {
  if (strWhrToInsert == 1) {
   onInsertAdvFormula(text);
  } else {
   onInsertAdvSimilary(text);
  }
}
}
functiononInsertAdvSql(text) {
if (document.frmAdvance.txeaExp.createTextRange && document.frmAdvance.txeaExp.caretPos) {
  var caretPos = document.frmAdvance.txeaExp.caretPos;
  caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text.value + " " : text.value;
} else {
  if (document.frmAdvance.txeaExp.value.length > 0) {
   document.frmAdvance.txeaExp.value = document.frmAdvance.txeaExp.value + text.value;
  } else {
   document.frmAdvance.txeaExp.value = text.value;
  }
}
}
functiononInsertNumRelation(text) {
var msg_str = "請您輸入!";
var input_num;
input_num = prompt(msg_str, "2");
if (input_num == null) {
  return false;
} else {
  if (input_num >= 1 && input_num < 10) {
   str = "(" + input_num + text.value;
  } else {
   alert("你的輸入超出了有效範圍!");
   return false;
  }
}
if (document.frmAdvance.txeaExp.createTextRange && document.frmAdvance.txeaExp.caretPos) {
  var caretPos = document.frmAdvance.txeaExp.caretPos;
  caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? str + " " : str;
} else {
  if (document.frmAdvance.txeaExp.value.length > 0) {
   document.frmAdvance.txeaExp.value = document.frmAdvance.txeaExp.value + str;
  } else {
   document.frmAdvance.txeaExp.value = str;
  }
}
}
 
評論列表
請選擇道具
<textarea class="content" id="commentEditor" style="BORDER-RIGHT: #ccc 1px solid; BORDER-TOP: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; COLOR: gray! important; BORDER-BOTTOM: #ccc 1px solid" onfocus="getUBBeditor(this)" rows="13" cols="50" name="content">點擊這裏發表評論</textarea>
溫馨提示:點擊驗證碼輸入框,以獲取驗證碼
請輸入驗證碼:
     
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章