Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > รบกวนดู code javascript หน่อยคร่า รันไม่ขึ้นอ่า 'กรุณากรอก Username ด้วยตัวเลขหรือตัวอักษรเท่านั้น



 

รบกวนดู code javascript หน่อยคร่า รันไม่ขึ้นอ่า 'กรุณากรอก Username ด้วยตัวเลขหรือตัวอักษรเท่านั้น

 



Topic : 031721



โพสกระทู้ ( 120 )
บทความ ( 0 )



สถานะออฟไลน์




<script type="text/javascript">
function checkform()
{
submitResult = false;
Name_BU = document.getElementById('Name_BU');
Lastname_BU = document.getElementById('Lastname_BU');
Username_BU = document.getElementById('Username_BU');
Password_BU = document.getElementById('Password_BU');



if((Username_BU.value != '') && (Password_BU.value != ''))
{
submitResult = true;

if(submitResult && (Username_BU.value.length < 6))
{
submitResult = false;
alert('กรุณากรอก Username อย่างน้อย 6 หลัก');
}
if(submitResult && (Username_BU.value.substring(0,2) != "au"))
{
submitResult = false;
alert('เบอร์โทรศัพท์ของคุณรูปแบบไม่ถูกต้อง กรุณาขึ้นต้นด้วย "08" ');
}
if(submitResult && !Username_BU.value.match(/^[\wก-ฮะ-์]+$/))
{
submitResult = false;
alert('กรุณากรอก Username ด้วยตัวเลขหรือตัวอักษรเท่านั้น\nไม่มีการเว้นวรรค และใช้เครื่องหมายใดๆ');
}
if(submitResult && !Password_BU.value.match(/^[\wก-ฮะ-์]+$/))
{
submitResult = false;
alert('กรุณากรอก Password ด้วยตัวเลขหรือตัวอักษรเท่านั้น\nไม่มีการเว้นวรรค และใช้เครื่องหมายใดๆ');
}


if(submitResult && (Name_BU.value == ""))
{
submitResult = false;
alert('กรุณาระบุชื่อ');
}
if(submitResult && (Lastname_BU.value == ""))
{
submitResult = false;
alert('กรุณาระบุนามสกุล');
}



else
{
alert('กรุณากรอก Username และ Password');
}


return submitResult;
}

</script>




<form name="form1" method="post" action="confirm_register_au.php"onsubmit="checkform()" />
<p align="center"><span class="style13"><span class="style5">
<label>
<input type="image" name="imageField" id="imageField" src="light_blue.gif">
</label>
<span class="style10">เพิ่มข้อมูลเจ้าหน้าที่งานรักษาความปลอดภัย</span></span> </span>
<label>
<input type="image" name="imageField2" id="imageField2" src="light_blue.gif">
</label>
</p>
<table width="362" border="0" align="center" bgcolor="#DFF8FF">
<tr bgcolor="#FFECFE">
<td colspan="2" bgcolor="#CCFFFF">&nbsp;</td>
</tr>

<tr>
<td width="152"><div align="right" class="style6 style12"><strong>ชื่อ:</strong></div></td>
<td width="200"><label>
<input type="text" name="Name_BU" id="Name_BU">
</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>นามสกุล :</strong></div></td>
<td><label>
<input type="text" name="Lastname_BU" id="Lastname_BU">
</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>ชื่อบัญชีผู้ใช้ :</strong></div></td>
<td><label>
<input name="Username_BU" type="text" id="Username_BU" size="10" maxlength="15">
ขึ้นต้นด้วยau</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>รหัสผ่าน :</strong></div></td>
<td><input name="Password_BU" type="password" id="Password_BU" size="10" maxlength="10"></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" id="submit" value="ตกลง">
<input type="reset" name="reset" id="reset" value="ยกเลิก">
</label></td>
</tr>
</table>
<p>
<label></label>
<label></label>
</p>
<p>&nbsp;</p>
</form>



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-09-14 19:11:40 By : dektatee View : 1166 Reply : 10
 

 

No. 1



โพสกระทู้ ( 1,528 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


Code
if((Username_BU.value != '') && (Password_BU.value != ''))
{
submitResult = true;
}


ลืมปิด } รึปล่าวครับ ลองดูนะครับ






Date : 2009-09-14 19:35:39 By : Sek-Artdrinker
 


 

No. 2



โพสกระทู้ ( 1,463 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Blogger

<script type="text/javascript">
function checkform()
{
submitResult = false;
Name_BU = document.getElementById('Name_BU');
Lastname_BU = document.getElementById('Lastname_BU');
Username_BU = document.getElementById('Username_BU');
Password_BU = document.getElementById('Password_BU');


if((Username_BU.value != '') && (Password_BU.value != ''))
{
	submitResult = true;
	
	if(submitResult && (Username_BU.value.length < 6))
	{
		submitResult = false;
		alert('กรุณากรอก Username อย่างน้อย 6 หลัก');
	}
	if(submitResult && (Username_BU.value.substring(0,2) != "au"))
	{
		submitResult = false;
		alert('เบอร์โทรศัพท์ของคุณรูปแบบไม่ถูกต้อง กรุณาขึ้นต้นด้วย "08" ');
	}
	if(submitResult && !Username_BU.value.match(/^[\wก-ฮะ-์]+$/))
	{
		submitResult = false;
		alert('กรุณากรอก Username ด้วยตัวเลขหรือตัวอักษรเท่านั้น\nไม่มีการเว้นวรรค และใช้เครื่องหมายใดๆ');
	}
	if(submitResult && !Password_BU.value.match(/^[\wก-ฮะ-์]+$/))
	{
		submitResult = false;
		alert('กรุณากรอก Password ด้วยตัวเลขหรือตัวอักษรเท่านั้น\nไม่มีการเว้นวรรค และใช้เครื่องหมายใดๆ');
	}
	
	
	if(submitResult && (Name_BU.value == ""))
	{
		submitResult = false;
		alert('กรุณาระบุชื่อ');
	}
	if(submitResult && (Lastname_BU.value == ""))
	{
		submitResult = false;
		alert('กรุณาระบุนามสกุล');
	}
	else
	{
		alert('กรุณากรอก Username และ Password');
	}
		
	return submitResult;
} else {
	alert('ระบุ user/password ด้วย');
	return false;
}

}

</script>




<form name="form1" method="post" action="confirm_register_au.php"onsubmit="return checkform();" >
<p align="center"><span class="style13"><span class="style5">
<label>
<input type="image" name="imageField" id="imageField" src="light_blue.gif">
</label>
<span class="style10">เพิ่มข้อมูลเจ้าหน้าที่งานรักษาความปลอดภัย</span></span> </span>
<label>
<input type="image" name="imageField2" id="imageField2" src="light_blue.gif">
</label>
</p>
<table width="362" border="0" align="center" bgcolor="#DFF8FF">
<tr bgcolor="#FFECFE">
<td colspan="2" bgcolor="#CCFFFF">&nbsp;</td>
</tr>

<tr>
<td width="152"><div align="right" class="style6 style12"><strong>ชื่อ:</strong></div></td>
<td width="200"><label>
<input type="text" name="Name_BU" id="Name_BU">
</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>นามสกุล :</strong></div></td>
<td><label>
<input type="text" name="Lastname_BU" id="Lastname_BU">
</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>ชื่อบัญชีผู้ใช้ :</strong></div></td>
<td><label>
<input name="Username_BU" type="text" id="Username_BU" size="10" maxlength="15">
ขึ้นต้นด้วยau</label></td>
</tr>
<tr>
<td><div align="right" class="style6 style12"><strong>รหัสผ่าน :</strong></div></td>
<td><input name="Password_BU" type="password" id="Password_BU" size="10" maxlength="10"></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" id="submit" value="ตกลง">
<input type="reset" name="reset" id="reset" value="ยกเลิก">
</label></td>
</tr>
</table>
<p>
<label></label>
<label></label>
</p>
<p>&nbsp;</p>
</form>

Date : 2009-09-14 19:40:52 By : num
 

 

No. 3



โพสกระทู้ ( 120 )
บทความ ( 0 )



สถานะออฟไลน์


ทำได้แล้วคร่า แต่ถ้านู๋เปลี่ยยนเป็น onchange หรือ onblur

แล้วที่เป็นalert ให้เปลี่ยนเป็นขึ้นที่ข้างหลัง Textbox ล่ะค่ะ

เปลี่ยนalert เป็นคำสั่งอารายคะ
Date : 2009-09-14 19:59:27 By : dektatee
 


 

No. 4



โพสกระทู้ ( 1,463 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Blogger

ตัวอย่างการ set ค่าจะต้องมี tag ที่กำหนด id ข้างหลัง textbox ก่อนครับ
<form name="form1"
onsubmit="document.getElementById('f1m').innerHTML = 'error 1'; return false;"
>
	<br />f1: <input type="text" name="f1" /><span id="f1m"></span>
	<br />f2: <input type="text" name="f2" /><span id="f2m"></span>
	<br />f3: <input type="text" name="f3" /><span id="f3m"></span>
	<br /><input type="submit" name="submit" />
</form>


ส่วนโค้ดที่ใช้ในการตรวจสอบข้อมูลดูที่เว็บนี้ครับ
http://cakephp.jitwitya.com/post/form-validation
Date : 2009-09-14 23:49:46 By : num
 


 

No. 5

Guest


ขอบคุณ คุณ(พี่...รึป่าว)num มากนะคะ อิอิ

ทำได้แล้วคร่า...หลังจาก นั่ง งง อยู่
Date : 2009-09-15 06:38:41 By : dektatee
 


 

No. 6



โพสกระทู้ ( 356 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ปีกกา เป็นเหตุ แหะๆๆ
Date : 2009-09-17 02:56:15 By : aknueng
 


 

No. 7

Guest


Go to : JavaScript HTML Check Input TextBox/Text Field
Date : 2011-04-20 13:48:28 By : suny
 


 

No. 8

Guest


Go to : JavaScript HTML Check Multiple Input TextBox/Text Field
Date : 2011-04-20 13:50:34 By : samme
 


 

No. 9

Guest


Go to : JavaScript Validation : การใช้งาน JavaScript ร่วมกับ Form
Date : 2011-04-20 13:52:11 By : suny
 


 

No. 10

Guest


Thank
Date : 2011-04-20 13:52:30 By : suny
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : รบกวนดู code javascript หน่อยคร่า รันไม่ขึ้นอ่า 'กรุณากรอก Username ด้วยตัวเลขหรือตัวอักษรเท่านั้น
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่