|
|
|
ถ้าต้องเช็คให้มีการกรอข้อมูลอย่างน้อย 1 ช่องควรจะเขียนยังไงดีครับ |
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>https://www.thaicreate.com/php/forum/087362.html</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="Unidetifier">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
</head>
<body>
<form>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center">1</td>
<td width="50" align="center">2</td>
<td width="50" align="center">3</td>
<td width="50" align="center">4</td>
<td width="50" align="center">5</td>
<td width="50" align="center">6</td>
</tr>
<tr>
<td align="center"><input name="textfield13" type="text" id="textfield19" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield13" type="text" id="textfield20" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield13" type="text" id="textfield21" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield13" type="text" id="textfield22" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield13" type="text" id="textfield23" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield13" type="text" id="textfield24" size="8" style="width:45px;"/></td>
</tr>
<tr>
<td width="50" align="center">7</td>
<td width="50" align="center">8</td>
<td width="50" align="center">9</td>
<td width="50" align="center">10</td>
<td width="50" align="center">11</td>
<td width="50" align="center">12</td>
</tr>
<tr>
<td align="center"><input name="textfield14" type="text" id="textfield13" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield14" type="text" id="textfield14" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield14" type="text" id="textfield15" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield14" type="text" id="textfield16" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield14" type="text" id="textfield17" size="8" style="width:45px;"/></td>
<td align="center"><input name="textfield14" type="text" id="textfield18" size="8" style="width:45px;"/></td>
</tr>
</table>
<input type="button" id="submit" value="submit" />
</form>
<script>
$("#submit").click(function(){
var count = 0;
$("input[type='text']").each(function(){
if($(this).val().length > 0)
count++;
});
if(count == 0) alert('please input some text!');
});
</script>
</body>
</html>
|
|
|
|
|
Date :
2012-11-28 12:52:59 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>https://www.thaicreate.com/php/forum/087362.html</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="Unidetifier">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
</head>
<body>
<form>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" align="center">1</td>
<td width="50" align="center">2</td>
<td width="50" align="center">3</td>
<td width="50" align="center">4</td>
<td width="50" align="center">5</td>
<td width="50" align="center">6</td>
</tr>
<tr>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield19" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield20" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield21" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield22" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield23" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield13" type="text" id="textfield24" size="8" style="width:45px;"/></td>
</tr>
<tr>
<td width="50" align="center">7</td>
<td width="50" align="center">8</td>
<td width="50" align="center">9</td>
<td width="50" align="center">10</td>
<td width="50" align="center">11</td>
<td width="50" align="center">12</td>
</tr>
<tr>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield13" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield14" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield15" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield16" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield17" size="8" style="width:45px;"/></td>
<td align="center"><input rel="example_group" name="textfield14" type="text" id="textfield18" size="8" style="width:45px;"/></td>
</tr>
</table>
<input type="button" id="submit" value="submit" />
</form>
<script>
$("#submit").click(function(){
var count = 0;
$("[rel=example_group]").each(function(){
if($(this).val().length > 0)
count++;
});
if(count == 0) alert('please input some text!');
});
</script>
</body>
</html>
ขอบคุณมากครับ
อย่างนี้ก็ได้ใช่ไหมครับ
|
|
|
|
|
Date :
2012-11-28 14:01:14 |
By :
pokultra |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2012-11-28 14:33:44 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากนะครับ ^^
|
|
|
|
|
Date :
2012-11-28 17:41:52 |
By :
pokultra |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|