DHTML PROGRAMS
PROGRAM1:
<html>
<head>
<title>Create an alert</title>
</head>
<body>
<h1 id = "para1">DQQQQQQ</h1>
<input type = "Submit" onclick = "Click()"/>
<script style = "text/javascript">
function Click() {
document.getElementById("para1").style.color = "#009900";
window.alert("Color changed to green");
}
</script>
</body>
</html>
PROGRAM2:
<html>
<head>
<title>Validate input data</title>
</head>
<body>
<p>Enter graduation percentage:</p>
<input id="perc">
<button type="button" onclick="Validate()">Submit</button>
<p id="demo"></p>
<script>
function Validate() {
var x, text;
x = document.getElementById("perc").value;
if (isNaN(x) || x < 60) {
window.alert("Not selected in GeeksforGeeks");
} else {
document.getElementById("demo").innerHTML =
"Selected: YOUR PERCENTAGE IS SAVED";
document.getElementById("demo").style.color = "#009900";
}
}
</script>
</body>
</html>
Comments
Post a Comment