11< html >
2+
23< head >
3- < title > DOM Access JS Quiz</ title >
4- < link rel ="stylesheet " href ="app.css ">
5- < script src ="jquery.js "> </ script >
6- < script type ="text/javascript " src ="jquery-ui.js "> </ script >
7- < script src ="app.js "> </ script >
4+ < title > DOM Access JS Quiz</ title >
5+ < link rel ="stylesheet " href ="app.css ">
6+ < script src ="jquery.js "> </ script >
7+ < script type ="text/javascript " src ="jquery-ui.js "> </ script >
8+ < script src ="app.js "> </ script >
89</ head >
910< h1 > Welcome to JS DOM Exercise</ h1 >
1011< p id ="para1 "> 1. Hello there..Could you identify me ? My id is para1</ p >
12+ < a href ="# " onclick ="identifyById() "> document.getElementsById</ a >
1113< hr >
1214< p class ="class1 "> 2. Hi again...I don't have a id but you can find by my class which is class1 </ p >
15+ < a href ="# " onclick ="identifyByClass() "> document.getElementsByClassName</ a >
1316< hr >
1417< p > 3. Oh.Oh.Oh.. wait a minute.. I don't have a id nor do I have a class in me.. Could you find me and my peers if I tell you that I am a p element ? </ p >
18+ < a href ="# " onclick ="byTag() "> document.getElementsByTagName</ a >
1519< hr >
1620< div id ="block1 "> 4. I am inside a div.Can you change my background color to blue.. My id is block1</ div >
21+ < a href ="# " onclick ="changeBackground() "> Change Background Color</ a >
1722< hr >
1823< div id ="block2 "> 5. On mouse click, can you increase my fontsize. My id is block2</ div >
24+ < a href ="# " onclick ="increaseFont() "> Increase Font Size</ a >
1925< hr >
20- < div id ="block3 "> 6. Can you change my font color to green on mouse over.. and roll it back to black when is mouse is moved out.. yeh..my id is block3</ div >
21- < hr >
22- < div id ="block4 "> 7. On double click, can you hide me ?. My id is block4</ div >
26+ < div id ="block3 " onmouseover ="changeFontColor() " onmouseout ="revertColor() "> 6. Can you change my font color to green on mouse over.. and roll it back to black when is mouse is moved out.. yeh..my id is block3</ div >
2327< hr >
24- 8. Can you please change all the boxes background color to green. All of them have class as box1 ?
28+ < div id ="block4 " ondblclick ="hide() "> 7. On double click, can you hide me ?. My id is block4</ div >
29+ < hr > 8. Can you please change all the boxes background color to green. All of them have class as box1 ?
2530< div class ="box1 "> </ div >
2631< div class ="box1 "> </ div >
2732< div class ="box1 "> </ div >
28- < hr >
29- 9. Can you now change all the box background color to blue on mouse click. All of them have class as box2 ?
30- < div class ="box2 "> </ div >
31- < div class ="box2 "> </ div >
32- < div class ="box2 "> </ div >
33- < hr >
34- 10. Can you just make this textbox to accept only numbers ?
35- < input type ="text " id ="input1 ">
33+ < a href ="# " onclick ="changeBackColor('green ', 'box1' ) "> Change background color</ a >
34+ < hr > 9. Can you now change all the box background color to blue on mouse click. All of them have class as box2 ?
35+ < div class ="box2 " onclick ="changeBackColor('blue','box2') "> </ div >
36+ < div class ="box2 " onclick ="changeBackColor('blue','box2') "> </ div >
37+ < div class ="box2 " onclick ="changeBackColor('blue','box2') "> </ div >
38+ < hr > 10. Can you just make this textbox to accept only numbers ?
39+ < input type ="text " id ="input1 " onkeypress ="return numbersOnly(event) ">
3640< hr >
3741< p id ='para2 '> 11. Can you add one more para below me with the text "I got generated on the fly...". My id is para2</ p >
42+ < a href ="# " onclick ="addAdjacent() "> Add new para</ a >
3843< hr >
3944< p id ='para3 '> 12. I don't like the fellow below me. Could you remove it. My id is para3 and next elment id is para4</ p >
4045< p id ='para4 '> 13. Are you going to remove me ? </ p >
46+ < a href ="# " onclick ="removePara() "> Remove para4</ a >
4147< hr >
4248< p > 14. Can you animate the below box. Its id is box5.</ p >
43- < div class ="box " id ="box5 "> </ div >
44-
45-
46- < h2 style = "text-align:center "> *********Dom Events**********</ h2 >
47- < ol >
48- < li >
49- < h4 > on Blurr & on Change- When you leave the input field, a function is triggered which transforms the input text to upper case.</ h4 >
50-
51- Enter your name: < input type ="text " id ="fname " onblur ="myFunction() ">
52- </ li >
53-
54- < li >
55- < h4 > When you leave the input field, a function is triggered which transforms the input text to upper case.</ h4 >
56- Enter your name: < input type ="text " id ="fname1 " onchange ="chageon() ">
57- </ li >
58-
59- < li >
60- < h4 > onchange - When a user selects a dropdown value</ h4 >
61- < form >
62- Choose which browser you prefer:
63- < select id ="browsers " onchange ="preferedBrowser() ">
49+ < div class ="box " id ="box5 " onmousemove ="myMove() "> </ div >
50+ < h2 style ="text-align:center "> *********Dom Events**********</ h2 >
51+ < ol >
52+ < li >
53+ < h4 > on Blurr & on Change- When you leave the input field, a function is triggered which transforms the input text to upper case.</ h4 > Enter your name:
54+ < input type ="text " id ="fname " onblur ="myFunction(fname.value) ">
55+ </ li >
56+ < li >
57+ < h4 > When you leave the input field, a function is triggered which transforms the input text to upper case.</ h4 > Enter your name:
58+ < input type ="text " id ="fname1 " onchange ="changeOn() ">
59+ </ li >
60+ < li >
61+ < h4 > onchange - When a user selects a dropdown value</ h4 >
62+ < form >
63+ Choose which browser you prefer:
64+ < select id ="browsers " onchange ="preferedBrowser() ">
6465 < option value ="Chrome "> Chrome</ option >
65- < option value ="Internet Explorer "> Internet Explorer</ option >
6666 < option value ="Firefox "> Firefox</ option >
67- </ select >
68- </ form >
69- </ li >
70-
71- < li >
72- < h4 > When the input field gets focus, a function is triggered which changes the background-color.</ h4 >
73- Enter your name: < input type ="text " onfocus ="color(this) ">
74- </ li >
75-
76- < li >
77- < h4 > When input text is selected</ h4 >
78- Some text: < input type ="text " value ="Hello world! " onselect ="inputxt() ">
79- < p id ="demo " style ="background-color:yellow "> </ p >
80-
81- </ li >
82-
83- < li >
84- < h4 > When a user clicks the submit button</ h4 >
85- < form onsubmit ="confirmInput() " action ="http://www.codeastra.com/ ">
86- Enter your name: < input id ="fname " type ="text " size ="20 ">
87- < input type ="submit ">
88- </ form >
89- </ li >
90- < li >
91- < h4 > When a user clicks the reset button</ h4 >
92- < form onreset ="message() ">
93- Enter your name: < input type ="text " size ="20 ">
94- < input type ="reset ">
95- </ form >
96- </ li >
97- < li >
98- < h4 > A function is triggered when the user is pressing a key in the input field.</ h4 >
99- < input type ="text " onkeydown ="keydown() ">
100- </ li >
101- < li >
102- < h4 > A function is triggered when the user is pressing a key in the input field.</ h4 >
103- < input type ="text " onkeypress ="keypress() ">
104- </ li >
105- < li >
106-
107- < h4 > A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.</ h4 >
108- Enter your name: < input type ="text " id ="fname2 " onkeyup ="keyup() ">
109- </ li >
110- < li >
111- < h4 > The onkeyup event occurs when the a keyboard key is on it's way UP.</ h4 >
112- < form >
67+ < option value ="Internet Explorer "> Internet Explorer</ option >
68+ </ select >
69+ </ form >
70+ </ li >
71+ < li >
72+ < h4 > When the input field gets focus, a function is triggered which changes the background-color.</ h4 > Enter your name:
73+ < input type ="text " onfocus ="color(this) ">
74+ </ li >
75+ < li >
76+ < h4 > When input text is selected</ h4 > Some text:
77+ < input type ="text " value ="Hello world! " onselect ="inputxt() ">
78+ < p id ="demo " style ="background-color:yellow "> </ p >
79+ </ li >
80+ < li >
81+ < h4 > When a user clicks the submit button</ h4 >
82+ < form onsubmit ="confirmInput() " action ="http://www.codeastra.com/ ">
83+ Enter your name:
84+ < input id ="fname " type ="text " size ="20 ">
85+ < input type ="submit ">
86+ </ form >
87+ </ li >
88+ < li >
89+ < h4 > When a user clicks the reset button</ h4 >
90+ < form onreset ="message() ">
91+ Enter your name:
92+ < input type ="text " size ="20 ">
93+ < input type ="reset ">
94+ </ form >
95+ </ li >
96+ < li >
97+ < h4 > A function is triggered when the user is pressing a key in the input field.</ h4 >
98+ < input type ="text " id ="input1 " onkeydown ="keydown(this) ">
99+ </ li >
100+ < li >
101+ < h4 > A function is triggered when the user is pressing a key in the input field.</ h4 >
102+ < input type ="text " id ="input2 " onkeypress ="keypress(event) ">
103+ < p > Key Code is < span id ="keycode "> </ span > </ p >
104+ </ li >
105+ < li >
106+ < h4 > A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.</ h4 > Enter your name:
107+ < input type ="text " id ="fname2 " onkeyup ="keyup() ">
108+ </ li >
109+ < li >
110+ < h4 > The onkeyup event occurs when the a keyboard key is on it's way UP.</ h4 >
111+ < form >
113112 Enter your name:
114113 < input type ="text " name ="myInput " onkeyup ="writeMessage() " size ="20 ">
115114 < input type ="text " name ="mySecondInput " size ="20 ">
116- </ form >
117- </ li >
118- </ ol >
119-
115+ </ form >
116+ </ li >
117+ </ ol >
120118
121119</ html >
0 commit comments