Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript_basics_day1 #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Abhisek_Kumar/externalJSFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function externalCall() {
alert("external file called");
}
40 changes: 40 additions & 0 deletions Abhisek_Kumar/javascriptBasics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- By - Abhisek Kumar -->
<!-- swiggyb1002 -->
<html>

<head>
<title>
JavaScript Basics
</title>
</head>
<script src="./externalJSFile.js">
</script>
<script>
function printSomething() {
alert("Hello World!!")
}

function consoleSomething() {
console.log("Hello");
}

function printInput(event) {
var x = document.getElementById("input1").value;
document.getElementById("output").innerHTML = x;
}
</script>

<body>
<button id="button1" onclick="printSomething();">Alert a message</button>
<div id="div1">This is div 1</div>
<div id="div2" onmouseover="consoleSomething();">Hover to Print on Console</div>
<button id="button2" onclick="document.getElementById('div1').innerHTML = 'This value was changed by button 2';">This is button 2</button>
<button onclick="print();">Print</button></br>
<button onclick="document.write('document write was moverovered');">Document write</button></br>
<button onclick="externalCall();">External Js file</button></br>
<input type="text" id="input1" onchange="printInput(event);"></br>
<div id="output"></div>

</body>

</html>