-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhartwick3.html
More file actions
47 lines (29 loc) · 867 Bytes
/
hartwick3.html
File metadata and controls
47 lines (29 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
<head>
<script src="hartwick1.js" type="text/javascript">
</script>
<script type="text/javascript">
function myFunction(p1, p2) {
return p1 * p2;
// The function returns the product of p1 and p2
}
myFunction(9,9); //this won't affect the interface
var a=4;
var b=2;
var c=myFunction(a,b); //this won't affect the interface
//this won't work
//Your script relies on the DOM being ready,
//so you need to execute that function call only after the DOM is ready.
document.getElementById("result2").innerHTML = myFunction(10, 200);
document.getElementById("p1").innerHTML = "New text!";
window.onload = function() {
document.getElementById("result1").innerHTML=c;
};
</script>
</head>
<body>
<div id="result1"> this is where </div>
<div id="result2"> this is where </div>
<div id="p1">Hello World!</div>
</body>
</html>