javascript - Bgcolor not working in while loop -


although know bgcolor not best thing use change web page's color dynamically, css route not appear allow numbers bgcolor (unless mistaken). code follows:

<!doctype html> <html>   <head>     <title>title</title>     <script>       while(1===1){         confirm("you click this";)         document.write("<h1>hello</h1>");         document.bgcolor = bgcolor;       }      </script>   </head>   <body></body> </html> 

i know code in infinite loop.

can try document.body.style.background instead of document.bgcolor?

also, have ask, why need infinite loop there?


Comments

Popular posts from this blog

My HTML document is not linking to my CSS stylesheet properly -

php array slice every 2th rule -

node.js - Sending sockets to client side, Error: Converting circular structure to JSON -