Email Validation
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
var b=emailfilter.test(document.form2.mailid.value);
if(b==false)
{
alert("Please Enter a valid Mail ID");
document.form2.mailid.focus();
return false;
}
Password Validation
var a = document.form.pass.value;
if(a=="")
{
alert("Please Enter Your Password");
document.form.pass.focus();
return false;
}
if ((a.length < 6) || (a.length > 20))
{
alert("Your Password must be 6 to 20 Character");
document.form.pass.select();
return false;
}
Mobile number Validation
var a = document.form.phone.value;
if(a=="")
{
alert("please enter your mobile no");
document.form.phone.focus();
return false;
}
if(isNaN(a))
{
alert("Enter the valid Mobile Number(Like : 9999911111)");
document.form.phone.focus();
return false;
}
if((a.length < 10) || (a.length > 10))
{
alert(" Your Mobile Number must be 10 Integers");
document.form.phone.select();
return false;
}
Gender Validation
ErrorText= "";
if ( ( form.gender[0].checked == false ) && ( form.gender[1].checked == false ) )
{
alert ( "Please choose your Gender: Male or Female" );
return false;
}
if (ErrorText= "") { form.submit() }
}
Asp.net by Hitesh Vataliya. Professional Trainer, where blogs related to the asp.net menu, webpage, xml, asp.net navigation, state management, create and manage user account, change password, forgot password, javascript and jquery validations, sliders, gridview, detailsview, datalist view all the topics are explained with necessary examples code.
Search This Blog
Saturday, April 6, 2013
Tuesday, April 2, 2013
Create Menu Using Javascript
First Create Six Images.
one.jpg
two.jpg
three.jpg
four.jpg
five.jpg
six.jpg
one and two for HOME
three and four for ABOUT
five and six for CONTACT
<html>
<head><title>Html Javascript </title>
<script = "text\javascript">
function f1()
{
img1.src="two.jpg";
}
function f2()
{
img1.src="one.jpg";
}
function f3()
{
img2.src="four.jpg";
}
function f4()
{
img2.src="three.jpg";
}
function f5()
{
img3.src="six.jpg";
}
function f6()
{
img3.src="five.jpg";
}
</script>
</head>
<body>
<img src="one.jpg" height="50px" width="150px" id="img1" alt="image" onmouseover="f1();" onmouseout="f2();" />
<img src="three.jpg" height="50px" width="150px" id="img2" alt="image" onmouseover="f3();" onmouseout="f4();" />
<img src="five.jpg" height="50px" width="150px" id="img3" alt="image" onmouseover="f5();" onmouseout="f6();" />
</body>
</html>
VB.Net SQL Server Connectivity For Insert New Record
//Create connection object
Dim con1 As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\student\Local Settings\Application Data\Temporary Projects\Databaseconvb\Database1.mdf;Integrated Security=True;User Instance=True")
//Create Command Object
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "INSERT tbl_user VALUES('" + txt_username.Text + "','" + txt_password.Text + "','" + txt_firstname.Text + "','" + txt_lastname.Text + "','" + gender.Text + "','" + txt_mobile.Text + "','" + txt_emailid.Text + "')"
cmd.Connection = con1
con1.Open()
cmd.ExecuteNonQuery()
con1.Close()
// It will perform the query of inserting new record into the table.
Dim con1 As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\student\Local Settings\Application Data\Temporary Projects\Databaseconvb\Database1.mdf;Integrated Security=True;User Instance=True")
//Create Command Object
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "INSERT tbl_user VALUES('" + txt_username.Text + "','" + txt_password.Text + "','" + txt_firstname.Text + "','" + txt_lastname.Text + "','" + gender.Text + "','" + txt_mobile.Text + "','" + txt_emailid.Text + "')"
cmd.Connection = con1
con1.Open()
cmd.ExecuteNonQuery()
con1.Close()
// It will perform the query of inserting new record into the table.
Subscribe to:
Comments (Atom)