<!DOCTYPE html>
<html>
<head>
<title>Fazool</title>
<script>
function change(){
document.getElementById('para').innerHTML = "Paragraph Changed";
}
</script>
</head>
<body>
<script>
window.alert("Success");
document.write(6*5);
</script>
<h1>JS can change the style of the content...!</h1>
<button type="button" onClick="change_style()">Click Me to change the style of the content</button>
<script>
function change_style(){
var x = document.getElementById('demo');
x.style.color = "white";
x.style.background = "blue";
}
</script>
<p id="demo">This content should be change on button click...!</p>
<h1>java script can check the input validation</h1>
<p>Enter the no b/w 1-10</p>
<input id="no" type="number">
<button type="button" onClick="validation()">Check</button>
<p id="line"></p>
<script>
function validation(){
var y,z;
y = document.getElementById('no').value;
if (y < 1 || y > 10)
{z = "Input is not OK";}
else
{z = "Input is OK";}
document.getElementById('line').innerHTML = z
}
</script>
<p id="para">A paragraph</p>
<button type="button" onClick="change()">Click</button>
<h1>Change Image...!</h1>
<p>Click on the image to change it...!</p>
<img id="img" src="1.JPG" onClick="image()" height="200" width="300">
<script>
function image(){
var i;
i = document.getElementById('img');
if (i.src.match("2.JPG"))
{i.src = "1.JPG"}
else
{i.src = "2.JPG"}
}
</script>
</body>
</html>
No comments:
Post a Comment