Professional Documents
Culture Documents
Webtech Lab03 JS 1stclass
Webtech Lab03 JS 1stclass
html:
<!DOCTYPE html>
<html>
<head>
<script src="script.js">
</script>
</head>
<body onload="f()">
<h2>JavaScript</h2>
<script>
//document.write("Value of x:"+ x);
var x = document.getElementsByClassName("example");
document.write(x);
// document.getElementById("demo").innerHTML = "Hello World";
document.getElementById("demo").style.color = "blue";
</script>
<button onclick="f()">
Click me
</button>
script.js:
//document.write("Speed");
//window.alert(5 + 6);
//console.log(5 + 6);
//
//var x=5;
//var name= "BUP"
//let obj;
//obj = null;
function f() {
alert("Onload event");
}
function keydown() {
document.getElementById("id1").style.backgroundColor = "red";
}
function keyup() {
document.getElementById("id1").style.backgroundColor = "green";
}