<script 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>
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>
<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;" value="1AsD" />
<input type="button" onclick="show()" value="Change" />
</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>
<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;" value="1AsD" />
<input type="button" onclick="show()" value="Change" />
</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>
Code Behind write:
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