-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageLoggingExample01.htm
More file actions
executable file
·41 lines (36 loc) · 1.31 KB
/
Copy pathPageLoggingExample01.htm
File metadata and controls
executable file
·41 lines (36 loc) · 1.31 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Console Logging Example</title>
</head>
<body>
<p>View debugging messages to the right.</p>
<script type="text/javascript">
function log(message){
var console = document.getElementById("debuginfo");
if (console === null){
console = document.createElement("div");
console.id = "debuginfo";
console.style.background = "#dedede";
console.style.border = "1px solid silver";
console.style.padding = "5px";
console.style.width = "400px";
console.style.position = "absolute";
console.style.right = "0px";
console.style.top = "0px";
document.body.appendChild(console);
}
console.innerHTML += "<p>" + message + "</p>";
}
function sum(num1, num2){
log("Entering sum(), arguments are " + num1 + "," + num2);
log("Before calculation");
var result = num1 + num2;
log("After calculation");
log("Exiting sum()");
return result;
}
var result = sum(10, 23);
</script>
</body>
</html>