File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > Webville Lounge</ title >
4+ < script >
5+
6+ var dj = {
7+ playsound : function ( ) {
8+ console . log ( "Playing " , this . sound ) ;
9+ } ,
10+ sound : "bells"
11+ } ;
12+
13+ var controller = {
14+ timer : null ,
15+ start : function ( ) {
16+ this . timer = setInterval ( dj . playsound . bind ( dj ) , 1000 ) ;
17+ } ,
18+ stop : function ( ) {
19+ clearInterval ( this . timer ) ;
20+ }
21+ } ;
22+
23+ window . onload = function ( ) {
24+
25+ //controller.start();
26+
27+ var startButton = document . getElementById ( "start" ) ;
28+ startButton . onclick = function ( ) {
29+ controller . start ( ) ;
30+ } ;
31+
32+ var stopButton = document . getElementById ( "stop" ) ;
33+ stopButton . onclick = function ( ) {
34+ controller . stop ( ) ;
35+ } ;
36+ } ;
37+
38+ </ script >
39+ </ head >
40+ < body >
41+ < button id ="start "> start</ button >
42+ < button id ="stop "> stop</ button >
43+ </ body >
44+ </ html >
45+
You can’t perform that action at this time.
0 commit comments