作者TonyQ (骨头)
看板Ajax
标题Re: [讨论]表单的必填栏位(整理)
时间Sun Apr 8 15:38:58 2007
※ 引述《TonyQ (骨头)》之铭言:
加入底下Function, 支援栏位自我检测,
(可利用 onChange="return _sekfCheck(this);")
并透过 errFocus 期标和 fnext 期标 设定
错误时及正确时的 focus对象
预设的 errFocus 和 fnext对象都是自己.
对 checkbox & radio 的自我检测,只适用在有id的那个是预设值的状况,
原则上我是认为checkbox radio不需要做自我检测.....@@
这是个非常简单的小东西,希望能对有需要的人有所帮助。^^
http://tony1223.no-ip.info/mylib/tony1223_form_check.js
话说这支程式的回响很少 看来它的实用性很低~ ̄▽ ̄
有人有其他推荐的lib 或 相关的意见欢迎联络我。
因为这是我主要操作form的工具。(自己写function 作操作不算的话) XD
────────────────────────────────
/* 对node的自我检测 使用 errFocus fnext期标 */
function _selfCheck(node){
if(!checkNode(getAttribute(node,"id"))){
if(hasAttribute(node,"errFocus")){
document.getElementById(getAttribute(node,"errFocus")).focus();
}else{
node.focus();
}
}else{
if(hasAttribute(node,"fnext")){
document.getElementById(getAttribute(node,"fnext")).focus();
}else{
node.focus();
}
}
}
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the compiler will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68