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

Javascript

This document summarizes a report on JavaScript tasks. It includes the code for several HTML files that demonstrate different JavaScript functions. Index.html contains a simple alert popup. DemoJs.html shows how to call an external JavaScript file. DemoJs.js writes text to the document. CobaAlert.html uses prompts and alerts in buttons. Inner.html updates an element's inner HTML. Lampu.html changes an image source with buttons. Hide.html hides an element with a button. Block.html shows a hidden element with a button.

Uploaded by

tsafifah13
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Javascript

This document summarizes a report on JavaScript tasks. It includes the code for several HTML files that demonstrate different JavaScript functions. Index.html contains a simple alert popup. DemoJs.html shows how to call an external JavaScript file. DemoJs.js writes text to the document. CobaAlert.html uses prompts and alerts in buttons. Inner.html updates an element's inner HTML. Lampu.html changes an image source with buttons. Hide.html hides an element with a button. Block.html shows a hidden element with a button.

Uploaded by

tsafifah13
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Laporan

Javascript

DATE \@ "MMMM d" \* MERGEFORMAT


February 29

Tugas Javascript
Authored by: Ja’far Ghifari.A

1
Index.html
<script type="text/javascript">
alert("Hallo World");
</script>

DemoJs.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>javascript</title>
</head>
<body>
<h2>Memanggil Javascript yang Terpisah</h2>
<script type="text/javascript" src="contoh.js"></script>
</body>
</html>

DemoJs.js
document.write("<strong>Demo Document </strong>");
document.write("text ini ditulis dengan javascript");

2
CobaAlert.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Javascript</title>
</head>
<body>
<h3>Halo Dunia</h3>
<input type="button" value="Join" onClick="coba()">
<script>
function coba() {
var masuk = confirm("Siap");
if (masuk) {
var nama = prompt("Apakah Kamu Siap");
if (masuk) {
alert("Selamat Kamu Adalah Seorang Siswa");
}
} else {
alert("Sebaiknya Kamu Ulangi")
}
}
</script>
</body>
</html>

3
Inner.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>inner</title>
</head>
<body>
<h2>What Can Javascript Do?</h2>
<p id="demo">Click The Button</p>
<button type="button"
onclick='document.getElementById("demo").innerHTML = "hi aja"'>Click
Here</button>
</body>
</html>

Lampu.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>lampu</title>
</head>
<body>
<button type="button" onclick='document.getElementById("lampu").src="coba (1).jpg"'>Click
Here Turn Off</button>
<img src="coba (1).jpg" id="lampu">
<button type="button" onclick='document.getElementById("lampu").src="coba (2).jpg"'>Click
Here Turn On</button>
</body>
</html>

4
Hide.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>inner</title>
</head>
<body>
<h2>What Can Javascript Do?</h2>
<p id="demo">Hide Me? Click The Button</p>
<button type="button"
onclick='document.getElementById("demo").style.display = "none"'>Click
Here</button>
</body>
</html>

Block.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>inner</title>
</head>
<body>
<h2>What Can Javascript Do?</h2>
<p id="test" style="display: none;">Hide Me? Click The Button</p>
<button type="button" onclick='document.getElementById("test").style.display =
"block"'>Click Here</button>
</body>
</html>

You might also like