Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 26-02-2007, 05:14 PM   #1 (permalink)
Alive Again...
 
satyamy's Avatar
 
Join Date: May 2005
Location: Mumbai
Posts: 1,668
Default Validation Code Help........


Can Someone find out error in this code
its a Validation Code
Quote:
<HTML>
<HEAD>
<TITLE> Validation Code </TITLE>

<Script language="JavaScript">
<!--
function validate()
{
l1=document.form1.txt_name.value
if(l1=="")
{
alert("Enter Your Namef")
document.form1.txt_name.focus();
return false
}
else
{
for(i=0;<l1.length;i++)
if(l1.charAt(i)>'Z'&&l1.charAt(i)<'a') || (l1.charAt(i)<'A') || (l1.charAt(i)>'z'))
{
alert("Enter a Valid Name")
document.form1.txt_name.focus()
return flase
}
}
-->
</script>

</HEAD>

<BODY>
<form name="form1">
Name
<input type="text" name="txt_name">
<input type="button" name="submit" value="submit" onClick="validate();">
</FORM>
</BODY>
</HTML>
satyamy is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 26-02-2007, 06:00 PM   #2 (permalink)
eWebGuru
 
ahref's Avatar
 
Join Date: Mar 2006
Location: Dehradun
Posts: 427
Default Re: Validation Code Help........

Here is the correct code
Code:
<HTML>
<HEAD>
<TITLE> Validation Code </TITLE>
<script language="JavaScript">
<!--
function validate()
{
l1=document.form1.txt_name.value
if(l1=="")
{
alert("Enter Your Namef")
document.form1.txt_name.focus();
return false
}
else
{
for(i=0;i<l1.length;i++)
{
if ((l1.charAt(i)>'Z')&&(l1.charAt(i)<'a') || (l1.charAt(i)<'A') || (l1.charAt(i)>'z'))
{
alert("Enter a Valid Name")
document.form1.txt_name.focus()
return false
}
}
}
}
-->
</script>

</HEAD>

<BODY>
<form name="form1">
Name
<input type="text" name="txt_name">
<input type="button" name="submit" value="submit" onClick="validate()">
</FORM>
</BODY>
</HTML>
__________________
Windows and linux hosting at http://www.ewebguru.com
Get $50 per blog post PM me for details.
ahref is offline  
Old 26-02-2007, 06:53 PM   #3 (permalink)
Alive Again...
 
satyamy's Avatar
 
Join Date: May 2005
Location: Mumbai
Posts: 1,668
Default Re: Validation Code Help........

thanks
i'll rep u for this kind help
satyamy is offline  
Old 26-02-2007, 06:55 PM   #4 (permalink)
HELP AND SUPPORT
 
rakeshishere's Avatar
 
Join Date: Jun 2006
Posts: 1,603
Default Re: Validation Code Help........

Was that a one-word answer
rakeshishere is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Piyush
- by icebags
- by clinton
- by Charan

Advertisement




All times are GMT +5.5. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2