0% found this document useful (0 votes)
2K views3 pages

1.write A Program To Use Intrinsic Functions in Javascript

The document contains code for two JavaScript programs. The first program uses intrinsic functions like submit() and reset() to submit and reset a form with name and age fields. The second program shows how to make a form field read-only or disabled by toggling the readOnly and disabled properties between true and false on click events. Buttons allow enabling or disabling the read-only and disabled states.

Uploaded by

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

1.write A Program To Use Intrinsic Functions in Javascript

The document contains code for two JavaScript programs. The first program uses intrinsic functions like submit() and reset() to submit and reset a form with name and age fields. The second program shows how to make a form field read-only or disabled by toggling the readOnly and disabled properties between true and false on click events. Buttons allow enabling or disabling the read-only and disabled states.

Uploaded by

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

Practica 9

/* 1.Write a program to use intrinsic functions in JavaScript*/

<html>
<head><title>INTRINSIC FUNCTIONS</title></head>
<body>
<form name="frm1" action="" method="post">
<p><b>Name : </b><input type="text" name="t1"
id="t1"> <br>
<b>Age : </b><input type="text" name="t2" id="t2">
<br>
<img src="submit.jpg" height="80" width="80"
onclick="javascript:document.forms.frm1.submit()"/>

<img src="reset.jpg" height="80" width="80"


onclick="javascript:document.forms.frm1.reset()"/>
</p>
</form>
</body>
</html>
Practica 9

/* 2. Write a program to show use of read-only and disabling


elements */

<html>
<script lang="Javascript" type="text/javascript">
function readonly_element()
{
document.forms.frn1.t1.readOnly = true;
}

function enter()
{
document.forms.t1.readOnly = false;
}

function disable_elemnt()
{
document.forms.frn1.t1.disabled = true;
}

function enable_element()
{
document.forms.frn1.t1.disabled = false;
}
</script>
<body>
<form name="frn1">
<h3>READONLY</h3>
<b>Enter Your Name :</b><input type="text"
name="t1" id="t1"><br><br>

<input type="button" value="Read Only"


onclick="readonly()">

<input type="button" value="Write"


onclick="enter()"> <br><br>

<h3>DISABLE</h3>
Practica 9

<b>Enter City :</b><input type="text" name="t1"


id="t1"><br><br>
<input type="button" value="Disable"
onclick="disable_element()">
<input type="button" value="Enable"
onclick="enable_element()">
</form>
</body>
</html>

You might also like