javascript - How to change the background color of form input when page loads? -


(i know can directly input style, have other intentions)

i tried several ways

<script> document.getelementbyid('mytextbox').style.backgroundcolor = 'red'; </script> <script> document.form1.mytextbox.style.backgroundcolor = 'red'; </script> 

i tried putting on head, on body. don't know else do

use onload

<body onload="style()"> 

and put code in function, @ bottom of body

<script type="text/javascript"> function style(){     document.getelementbyid('mytextbox').style.backgroundcolor = 'red'; } </script> </body> 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -