RSS

Simple Captcha Create with Javascript Code

10 Jul

the Below Code write in Header

<script language=”javascript”>

var a = 49, b = 65;

var c = 100;

var d = 70;

function show()

{

if (a == 57) {

a = 49;

}


var main = document.getElementById(‘txt1’);

var a1 = String.fromCharCode(a);

var b1 = String.fromCharCode(b);

var c1 = String.fromCharCode(c);

var d1 = String.fromCharCode(d);


main.value = a1 + b1 + c1 + d1;

a = a + 1;

b = b + 1;

c = c + 1;

d = d + 1;

}

</script>

write this code in body ………..

<body>

<form id=”form1″ runat=”server”>

<div>

<input type=”text” id=”txt1″ runat=”server”

style=”border-style: none; border-color: inherit; border-width: medium; background-color:black; color:red; font-family: ‘Curlz MT’; font-size: x-large; font-weight: bold; font-variant: normal; letter-spacing: 10pt; width: 120px; background-image: url(‘glitter_background_b4.gif’);”

value=”5AbD” />

<input type=”button” onclick=”show()” value=”Change”  />

</div>

<asp:TextBox ID=”txtverification” runat=”server”></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Button ID=”Button1″ runat=”server” Text=”Verification”

onclick=”Button1_Click” />

&nbsp;&nbsp;&nbsp;&nbsp;

<asp:Label ID=”lblmsg” runat=”server” Font-Bold=”True” ForeColor=”Red”></asp:Label>

</form>

</body>

check or verification of Random Generate Captcha Code and write this code in Code-Behind .CS File

In the (.cs) page I write the following code for varification:->

protected void Button1_Click(object sender, EventArgs e)

{

if (txtverification.Text == txt1.Value)

{

lblmsg.Text = “Successfull”;

}

else

{

lblmsg.Text = “Failure”;

}

}


Advertisements
 
2 Comments

Posted by on July 10, 2010 in Java Script

 

2 responses to “Simple Captcha Create with Javascript Code

  1. Jesse Nazir

    February 7, 2011 at 1:55 am

    I must say i love your writing together with the web site altogether! Could well be awesome to learn wherever I will have that. You’ll want to carry on the excellent work. Everyone require all the more such web owners exactly web also much less spammers. Wonderful man!

     
  2. humrahimcs

    April 28, 2011 at 6:02 am

    Thanks Jesse…

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: