0% found this document useful (0 votes)
20 views3 pages

Assignment 6

The document contains a JavaScript code to generate a login page with captcha. It uses random number generation functions to output 6 random numbers on page load and on clicking a button. The code is embedded in HTML tags to display the login form with input fields for username, password and generated captcha code.

Uploaded by

GOURAV SINHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Assignment 6

The document contains a JavaScript code to generate a login page with captcha. It uses random number generation functions to output 6 random numbers on page load and on clicking a button. The code is embedded in HTML tags to display the login form with input fields for username, password and generated captcha code.

Uploaded by

GOURAV SINHA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment – 6

Q) Write a javascript code for login page with captcha


generation.
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial- scale=1.0">

<title> Login page that generates random numbers </title>

<link rel="stylesheet" href="../node_modules/bootstrap-


icons/font/bootstrap-icons.css">

<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">

<style> dd,dt {

margin-top: 20px;

margin-left: 20px;

</style>

<script type="text/javascript">

function GenerateCode() { var a =

Math.random() * 10; var b =

Math.random() * 10; var c =

Math.random() * 10; var d =

Math.random() * 10; var e =

Math.random() * 10; var f =


Math.random() * 10;

return `${Math.round(a)} ${Math.round(b)}


${Math.round(c)} ${Math.round(d)} ${Math.round(e)}
${Math.round(f)}`;

}
function bodyload(){

document.getElementById("code").innerHTML =
GenerateCode();

function NewCode(){

bodyload();

</script>

</head>

<body onload="bodyload()">

<fieldset>

<legend>User Login</legend>

<dl>

<dt>User Name</dt>

<dd><input type="text"></dd>

<dt>Password</dt>

<dd><input type="password"></dd>

<dt>Verify Code

<button onclick="NewCode()" class="btn btn- success"><span class="bi bi-


arrow-clockwise"></span></button>

</dt>

<dd><span id="code"></span></dd>

</dl>

<button>Login</button>

</fieldset>

</body>

</html>
OUTPUT:

SUBMITTED BY:
NAME: Hari Prasad Misra
REG : 2101020556
ROLL: CSI21036
BRANCH: CSE(IOT&CS)
GROUP: 8

You might also like