+ 1

Is this correct

<!DOCTYPE html> <html> <head> <title>My First Program</title> </head> <body> <h1 id="h">Welcome To My Page</h1> <h3>Design Your Own Heading</h3> <h5>Write Text</h5> <button onclick="c1()">Text</button> <h5>Choose Color</h5> <button onclick="c2()">Red</button> <button onclick="c3()">Blue</button> <button onclick="c4()">Green</button> <script> function c1(){ var a = document.getElementById("h") var b = prompt("Enter Text") a.innerHTML=b } function c2(){ var c = document.getElementById("h"); c.style.color="red"; } function c3(){ var d = document.getElementById("h"); d.style.color="blue"; } function c4(){ var e = document.getElementById("h"); e.style.color="green"; } </script> </body> </html>

8th Oct 2020, 12:41 PM
Priyanshu Kumar
Priyanshu Kumar - avatar
2 odpowiedzi
+ 6
Yes,it's working fine ! To check if your code has invisible error or not,you can use validator. here is the link for validator ,check in this) https://validator.w3.org/#validate_by_input
8th Oct 2020, 12:45 PM
chaithra Gowda
chaithra Gowda - avatar
+ 2
Okh thx
8th Oct 2020, 1:03 PM
Priyanshu Kumar
Priyanshu Kumar - avatar