javascript - How can I change the css property display to block from PHP code -


i'm trying set form validation contact page, , have set if there nothing in of input boxes won't send e-mail. want show hidden div have displays "please fill in boxes". code have,

echo "         <script type=\"text/javascript\">             document.getelementbyid('notvalid').style.display = 'block';         </script>     "; 

after use header refresh page. default css rule #notvalid set display: none; have been doing lot of research, , can't seem figure out.

while cristyan has solution, don't think need wait dom content load(downloading of images , other non html content files), can execute js html finished loading:

echo "<script type=\"text/javascript\">         window.onload = function() {           document.getelementbyid('notvalid').style.display = 'block';         };       </script>"; 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -