Click here to Skip to main content
16,004,458 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Program giving a error on line 19, missing a semicolon. I try everything that I could think off.

What I have tried:

<!DOCTYPE html>
<html lang = "en-US">
<head>
 <meta charset = "UTF-8">
 <title>backgroundColor</title>
 </head>
<body>
    <h1>Click a button to change the Color</h1>
    <form action = "">
     <fieldset>
     <input type = "button"
            value = "blue"
            onclick = "document.body.style.backgroundColor = 'blue'" />
     <input type = "button"
            value = "white"
            onclick = "document.body.style.backgroundColor = 'white'" />
     <input type = "button"
            value = "Orange"
            onclick = "document.body.style.backgroundColor = 'orange'" />
 </fieldset>   
  </form>
  </body>
</html>
Posted
Updated 30-Jul-21 18:40pm
Comments
Jon McKee 30-Jul-21 23:48pm    
After copy-pasting that into an html file, it works just fine for me on Firefox 90.0.2.
Richard MacCutchan 31-Jul-21 4:03am    
You have posted the HTML not the Javascript.

1 solution

If I copy and paste your sample into a new HTML file and openthat in Chrome, or Edge, or even IE it works fine.

I'd suggest that you look at the page giving the error in your prefered browser's developer tools (Right click and "view page source", right click and "inspect", or similar) and also check that any code behind is not generating the error.

Sorry, we can't do any of that for you, and if we can't reproduce the problem we can#t help solve it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900