Skip to content

Commit 5e1c0a3

Browse files
author
Em01
committed
ciw basics
1 parent a45d265 commit 5e1c0a3

12 files changed

+106
-29
lines changed

.DS_Store

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

ciw/javascript_spec_labfiles/Lesson

+28-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<script type="text/javascript">
5-
var string1 = start;
6-
var string2 = prompt();
7-
var string3 = confirm();
8-
var string4 = end;
9-
10-
</script>
11-
</head>
12-
13-
<body>
14-
15-
<script type="text/javascript">
16-
document.write("<h3>Hello, World</h3>");
17-
18-
</script>
19-
20-
</body>
3+
<head>
4+
<script type="text/javascript">
5+
function add(arg1, arg2) {
6+
return arg1 + arg2;
7+
};
8+
9+
function subtract(arg1, arg2) {
10+
return arg1 - arg2;
11+
}
12+
13+
function multiply(arg1, arg2){
14+
return arg1 * arg2;
15+
};
16+
17+
function divide(arg1, arg2) {
18+
return arg1 / arg2;
19+
};
20+
</script>
21+
</head>
22+
<body>
23+
<script type="text/javascript">
24+
document.write(add(1, 2) + "<br>");
25+
document.write(subtract(2, 2) + "<br>");
26+
document.write(multiply(5, 6) + "<br>");
27+
document.write(divide(4, 6) + "<br>");
28+
29+
</script>
30+
</body>
2131
</html>
22-
23-
24-

ciw/javascript_spec_labfiles/Lesson 03/example_castingError.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var a = 1;
1717
var b = 2;
1818
var c = "The answer is " + a + b;
19-
alert(c);
19+
alert(c); //will return 12
2020
}
2121

2222
//-->

ciw/javascript_spec_labfiles/Lesson 03/lab3-1.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<!-- Add an onload event handler to call the function -->
2424

25-
<body >
25+
<body onload="myFunction();">
2626

2727
<h3>CIW JavaScript Specialist</h3>
2828
<hr />

ciw/javascript_spec_labfiles/Lesson 03/lab3-2.htm

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h3>CIW JavaScript Specialist</h3>
2929
<!-- Add an onclick event handler to call the function -->
3030

3131
<form name="myForm">
32-
<input type="button" VALUE="Call Function" />
32+
<input type="button" VALUE="Call Function" onclick="myFunction();" />
3333
</form>
3434

3535
</body>

ciw/javascript_spec_labfiles/Lesson 03/lab3-2a.htm

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
and uses its value in the alert() method.
1515
**************************************************************/
1616

17-
function myFunction( ) {
18-
alert("The function has been called and was passed " );
17+
function myFunction(arg1) {
18+
alert("The function has been called and was passed " + arg1);
1919
}
2020

2121
//-->
@@ -27,7 +27,7 @@ <h3>CIW JavaScript Specialist</h3>
2727
<!-- A form button is used to call the function.
2828
Pass the value 'a string of text' as an argument to the function -->
2929
<form name="myForm" id="myForm">
30-
<input type="button" value="Call Function" onclick="myFunction( );" />
30+
<input type="button" value="Call Function" onclick="myFunction('a string of text');" />
3131
</form>
3232
</body>
3333
</html>

ciw/javascript_spec_labfiles/Lesson 03/lab3-2b.htm

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
function myFunction(arg1) {
1818
alert("The function has been called and was passed " + arg1);
19-
19+
return "myFunction() return value"
2020
}
2121

2222
//-->
@@ -32,7 +32,7 @@ <h3>CIW JavaScript Specialist</h3>
3232
Wrap an alert() method around the function call.
3333
-->
3434
<form name="myForm" id="myForm">
35-
<input type="button" value="call function" onclick="myFunction('a string of text');" />
35+
<input type="button" value="call function" onclick="alert(myFunction('a string of text'));" />
3636
</form>
3737
</body>
3838
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html>
2+
<head>
3+
<script type="text/javascript">
4+
5+
</script>
6+
</head>
7+
<body>
8+
<script type="text/javascript">
9+
</script>
10+
</body>
11+
</html>
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script type="text/javascript">
5+
function add(arg1, arg2) {
6+
return arg1 + arg2;
7+
};
8+
9+
function subtract(arg1, arg2) {
10+
return arg1 - arg2;
11+
}
12+
13+
function multiply(arg1, arg2){
14+
return arg1 * arg2;
15+
};
16+
17+
function divide(arg1, arg2) {
18+
return arg1 / arg2;
19+
};
20+
</script>
21+
</head>
22+
<body>
23+
<script type="text/javascript">
24+
document.write(add(1, 2) + "<br>");
25+
document.write(subtract(2, 2) + "<br>");
26+
document.write(multiply(5, 6) + "<br>");
27+
document.write(divide(4, 6) + "<br>");
28+
29+
</script>
30+
</body>
31+
</html>

events/event_handler.js

+14
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@
77
//onload
88
<body onload="myfunction()">
99

10+
11+
onclick();
12+
onblur();
13+
onfocus();
14+
onmouseover();
15+
onmouseout();
16+
onsubmit();
17+
onreset();
18+
onchange();
19+
onselect();
20+
onabort();
21+
onerror();
22+
onload();
23+
onunload();

events/user_events.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
abort();
2+
blur();
3+
click();
4+
change();
5+
error();
6+
focus();
7+
load();
8+
mouseOver();
9+
mouseOut();
10+
reset();
11+
select();
12+
submit();
13+
unload();

0 commit comments

Comments
 (0)