File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
12< html lang ="en ">
23< head >
34 < meta charset ="UTF-8 ">
4- < meta name ="viewport " content ="width= , initial-scale=1.0 ">
5+ < meta name ="viewport " content ="width=device-width , initial-scale=1.0 ">
56 < title > Document</ title >
7+ < style >
8+ .btn {
9+ padding : 10px 20px ;
10+ }
11+
12+
13+ </ style >
614</ head >
715< body >
16+ < a href ="https://www.google.com " target ="_blank "> google</ a >
17+ < button class = "btn " style ="background-color: blue; "> click me</ button >
18+ < script >
19+ a
20+ const btn = document . querySelector ( ".btn" ) ;
21+ console . log ( btn . innerText ) ;
22+ btn . innerText += "click" ;
23+ console . log ( btn . innerText ) ;
24+ console . log ( btn . innerText . style . backgroundColor ) ;
25+ btn . style . color = "green" ;
26+ const youtube = document . querySelector ( 'a' ) ;
27+ console . log ( youtube ) ;
28+ youtube . href = "https://www.youtube.com/" ;
29+ youtube . textContent = "youtube" ;
30+ console . log ( youtube ) ;
31+ </ script >
832
933</ body >
10- </ html >
34+ </ html >
35+
36+ <!-- <!DOCTYPE html>
37+ <html lang="en">
38+ <head>
39+ <meta charset="UTF-8">
40+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
41+ <title>Document</title>
42+ </head>
43+ <body>
44+ <a href="https://www.google.com" target="_blank">google</a>
45+ <script>
46+
47+ const change=document.querySelector('a');
48+ console.log(change);
49+ change.href="https://www.youtube.com/";
50+ change.textContent="youtube";
51+ console.log(change);
52+ </script>
53+ </body>
54+ </html> -->
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < title > Todo List</ title >
5+ < style >
6+ body {
7+ font-family : Arial;
8+ background : # f4f4f4 ;
9+ display : flex;
10+ justify-content : center;
11+ margin-top : 50px ;
12+ }
13+
14+ .container {
15+ background : white;
16+ padding : 30px ;
17+ width : 400px ;
18+ border-radius : 10px ;
19+ box-shadow : 0 0 10px gray;
20+ }
21+
22+ input {
23+ width : 70% ;
24+ padding : 10px ;
25+ }
26+
27+ button {
28+ padding : 10px ;
29+ }
30+
31+ ul {
32+ padding : 0 ;
33+ list-style : none;
34+ }
35+
36+ li {
37+ margin-top : 10px ;
38+ background : # ddd ;
39+ padding : 10px ;
40+ display : flex;
41+ justify-content : space-between;
42+ }
43+
44+ .delete {
45+ background : red;
46+ color : white;
47+ border : none;
48+ }
49+ </ style >
50+ </ head >
51+ < body >
52+
53+ < div class ="container ">
54+ < h2 > To Do List</ h2 >
55+
56+ < input type ="text " id ="task ">
57+ < button onclick ="addTask() "> Add</ button >
58+
59+ < ul id ="list "> </ ul >
60+ <!-- Tasks will appear here = -->
61+ </ div >
62+
63+ < script >
64+ function addTask ( ) {
65+
66+ let task = document . getElementById ( "task" ) . value ;
67+
68+ if ( task == "" ) {
69+ alert ( "Enter task" ) ;
70+ return ;
71+ }
72+
73+ let li = document . createElement ( "li" ) ;
74+ li . innerHTML = task +
75+ '<button class="delete" onclick="this.parentElement.remove()">Delete</button>' ;
76+
77+ document . getElementById ( "list" ) . appendChild ( li ) ;
78+
79+ document . getElementById ( "task" ) . value = "" ;
80+ }
81+ </ script >
82+
83+ </ body >
84+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Color change</ title >
7+ < style >
8+
9+ </ style >
10+ </ head >
11+ < body >
12+ < button onclick ="colorchange() "> click me </ button >
13+ < script > const bgcolor = [ "red" , "pink" , "black" , "white" ] ;
14+ const btncolor = [ "blue" , "red" , "yello" , "pink" ] ;
15+ let index = 0 ;
16+ function colorchange ( ) {
17+ document . body . style . backgroundColor = bgcolor [ index ] ;
18+ const btn = document . querySelector ( "button" ) ;
19+ btn . style . backgroundColor = btnColors [ index ] ;
20+ }
21+ </ script >
22+ </ body >
23+ </ html >
You can’t perform that action at this time.
0 commit comments