Download as pdf or txt
Download as pdf or txt
You are on page 1of 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