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

CSS Practical Programs

pr

Uploaded by

waghsam099
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)
5 views

CSS Practical Programs

pr

Uploaded by

waghsam099
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/ 5

Pr -1 program

<html>
<head>
<title> Hello World </title>
</head>
<body>
<script type="text/javascript">
var a = parseInt(prompt("Enter the vlaue of a: "));
var b = parseInt(prompt("Enter the vlaue of b: "));
var c = a + b;
var d = a - b;
var e = a * b;
var f = a / b;
var g = a % b;
document.write("add is " + c);
document.write("<br>");
document.write("sub is " + d);
document.write("<br>");
document.write("mul is " + e);
document.write("<br>");
document.write("division is " + f);
document.write("<br>");
document.write("mod is " + g);
document.write("<br>");
</script>
</body>
</html>
Pr-5 Program
<!doctype html>
<html>

<head>
<script>
var num1, num2;

function add() {
var sum;
num1 = parseInt(document.getElementById("firstnumber").value);
num2 = parseInt(document.getElementById("secondnumber").value);
sum = num1 + num2;
document.getElementById("answer").value = sum;
}
function sub() {
var differ;
num1 = parseInt(document.getElementById("firstnumber").value);
num2 = parseInt(document.getElementById("secondnumber").value);
differ = num1 - num2;
document.getElementById("answer1").value = differ;
}
</script>
</head>

<body>
<p>First Number: <input id="firstnumber"></p>
<p>Second Number: <input id="secondnumber"></p>
<button onclick="add()">Add Them</button>
<button onclick="sub()">Substract Them</button>
<p>Sum = <input id="answer"></p>
<p>Differ = <input id="answer1"></p>

</body>

</html>
Pr-9 Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Enable/Disable Button</title>
</head>
<body>

<input type="text" id="input1" oninput="toggleButton()">


<input type="text" id="input2" oninput="toggleButton()">
<button id="submitButton" disabled>Submit</button>

<script>
function toggleButton() {
document.getElementById('submitButton').disabled =
!document.getElementById('input1').value ||
!document.getElementById('input2').value;
}
</script>

</body>
</html>
Pr-11 Program
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Open Child Window</title>
</head>
<body>

<h1>Parent Window</h1>
<button onclick="openChildWindow()">Open Child Window</button>

<script>
function openChildWindow()
{
window.open("child.html", "ChildWindow", "width=400,height=300");
}
</script>

</body>
</html>
Pr-15 Program
<html>
<head>
<script>
var slides = new Array('img1.jpg','img2.jpg','img3.jpg','img4.jpg')
var id = 0
function showImage(move) {
if(move == -1 && id !=0)
id--
if(move == 1 && id !=4)
id++
document.image.src = slides[id]
}
</script>
</head>
<body>

<a href="http://www.youtube.com"><img src="banner.jpg", height="250" ,


width="250"></a>

<center>
<img src="img1.jpg" name="image""width="400" height="400"/>
<input type="button" value="Previous" onclick="showImage(-1)">
<input type="button" value="Next" onclick="showImage(1)">
</center>
</body>
</html>

You might also like