|
 |
|
อยากทราบโค้ด textbox คร้า...คือเวลากรอกเลขจนเตม textbox แล้ว ปกติเราจะกด tab เพื่อให้ไปอีก textbox อีกอัน |
|
 |
|
|
 |
 |
|
<script type="text/javascript">
function fncMovenext(thisObj,nextObj,_len){
if(thisObj.value.length == _len){
nextObj.focus();
}
}
</SCRIPT>
<input type="text" name="txt1" id="txt1" onKeyUp="fncMovenext(this,txt2,6);">
<input type="text" name="txt2" id="txt2">
ลองดู ครับ
|
 |
 |
 |
 |
Date :
2012-03-20 11:17:51 |
By :
Thep |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (JavaScript)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<form name="frmMain" action="" method="post">
<script language="JavaScript">
function setNextFocus(ctrl,objId){
if (ctrl.maxLength == ctrl.value.length){
var obj=document.getElementById(objId);
if (obj){
obj.focus();
}
}
}
</script>
Textbox 1 <input type="text" name="txt1" maxlength="10" value="" onKeyUp="setNextFocus(this,'txt2');"> <br>
Textbox 2 <input type="text" name="txt2" maxlength="10" value="" onKeyUp="setNextFocus(this,'txt3');"> <br>
Textbox 3 <input type="text" name="txt3" value=""><br>
<input type="submit" name="btnSubmit" value="Submit">
</form>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-03-20 11:23:43 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|