0% found this document useful (0 votes)
48 views

HTML and Javascript Program for Theory 2025

The document contains HTML and JavaScript code examples for creating web pages and forms. It includes a simple webpage with personal details and a form for application submission, as well as scripts to check if a number is positive or negative and to calculate the square of a number. The examples demonstrate basic web development concepts including form handling and user input processing.

Uploaded by

prekahaisproblem
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)
48 views

HTML and Javascript Program for Theory 2025

The document contains HTML and JavaScript code examples for creating web pages and forms. It includes a simple webpage with personal details and a form for application submission, as well as scripts to check if a number is positive or negative and to calculate the square of a number. The examples demonstrate basic web development concepts including form handling and user input processing.

Uploaded by

prekahaisproblem
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/ 2

HTML

1) Write a program using HTML with following specifications.


The background colour should be green. The text colour should be red.
The heading should be large in size as 'My First Web Page'. Display a horizontal line after the
heading.
Display your name in Bold, address in Italics and standard as 11th .

<!doctype html>
<html>
<head>
<title>Personal Details</title>
</head>

<body bgcolor=green text=red>

<h1>My First Web Page</h1>


<hr>
Name:<b>Amit Patel</b><br>
Address:<i>203 Raj Tower, Kandivali(West)</i><br>
Standard:11<sup>th</sup>

</body>
</html>

2) Create a webpage with following specification.


 Display heading 'Application Form' in highest heading with center alignment.
 Accept name, standard 11th or 12th with only one selection choice.
 Submit the form.

<!doctype html>
<html>
<head>
<title>form</title>
</head>

<body>

<h1 align=center>Application Form</h1>


<form name=f1>
Enter Name:<input type=text name=t1><br>
Standard:
<input type=radio name=r1 value=1>11<sup>th</sup>
<input type=radio name=r1 value=2>12<sup>th</sup>
<br>
<input type=submit name=submit value=submit>
</form>
</body>
</html>

1
JAVASCRIPT

1) To check whether, user entered number is positive or negative

<!doctype html>
<html>
<head>
<title>Positive negative</title>
</head>
<body>

<script language=javascript>
n=parseInt(prompt("Enter a number"))
if(n>0)
document.write(n+" is positive")
else
document.write(n+" is negative")
</script>
</body>
</html>

2) To accept number and display square of it.

<!doctype html>
<html>
<head>
<title>Square</title>
</head>
<body>

<script language=javascript>
n=parseInt(prompt("Enter a number"))
document.write("The square of " + n + " is " + n*n)
</script>
</body>
</html>

You might also like