0

Plz help me to find my problem . I want to change backgroundcolor using the button .sorry I am weak in English .

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <button onclick="green()">green</button> <button onclick="yellow()">yellow</button> <script type="text/javascript"> function green(){ document.body.style.backgroundcolor="red" } function yellow(){ document.body.style.backgroundcolor ="yellow" } </script> </body> </html>

28th Aug 2018, 2:18 AM
COMEDY KING
6 Antworten
+ 4
try to use "backgroundColor"
28th Aug 2018, 3:01 AM
Teostra
Teostra - avatar
+ 3
Teostra is correct. Perhaps there are other bugs in your code. It would be better if you post the code link so we can help you better. Here's a sample code: https://code.sololearn.com/WlRs554xPoWF/?ref=app
28th Aug 2018, 3:21 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 2
COMEDY KING I made another example, compare Jonathan Pizarra's code and mine and see which one is more easy for you to understand. https://code.sololearn.com/W6M9NhnMMAIH/?ref=app
28th Aug 2018, 3:30 AM
Teostra
Teostra - avatar
0
Thanks friends ....
28th Aug 2018, 5:41 AM
COMEDY KING
0
No problem
28th Aug 2018, 10:18 AM
Teostra
Teostra - avatar
- 1
thanks but it is not working.
28th Aug 2018, 3:07 AM
COMEDY KING