Default3.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function show()
{
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 5;
var randomstring = '';
for (var i=0; i<string_length; i++)
{
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
var main = document.getElementById('txt1');
main.value = randomstring;
}
</script>
</head>
<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;padding-left:10px;
width: 135px;" value="1AsD" />
<input type="button" onclick="show()" value="Change Capcha Image" />
</div>
<asp:TextBox ID="txtverification" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Verification" OnClick="Button1_Click" />
<asp:Label ID="lblmsg" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
function show()
{
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 5;
var randomstring = '';
for (var i=0; i<string_length; i++)
{
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum,rnum+1);
}
var main = document.getElementById('txt1');
main.value = randomstring;
}
</script>
</head>
<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;padding-left:10px;
width: 135px;" value="1AsD" />
<input type="button" onclick="show()" value="Change Capcha Image" />
</div>
<asp:TextBox ID="txtverification" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Verification" OnClick="Button1_Click" />
<asp:Label ID="lblmsg" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</form>
</body>
</html>
Default3.aspx.cs
protected void Button1_Click(object sender, EventArgs e)
{
if (txtverification.Text == txt1.Value)
{
lblmsg.Text = "Successfull";
}
else
{
lblmsg.Text = "Failure";
}
}
{
if (txtverification.Text == txt1.Value)
{
lblmsg.Text = "Successfull";
}
else
{
lblmsg.Text = "Failure";
}
}
No comments:
Post a Comment