html - Run javascript function on load -


i trying use script run function on page load. can see what's wrong? stupid error, i'm sure - can't work out.

code:

<script>    var text = document.getelementbyid("mytext");    function changefontsize(){   if (window.innerwidth < 600) { text.style.fontsize = "70px";       } else {       text.style.fontsize = "100px";       }   }    window.onresize = changefontsize;    </script>    <script>   settimeout(function() changefontsize, 3000);   </script> 

window.onload = changefontsize; window.onresize = changefontsize; 

alternatively, can use

window.addeventlistener("onload", changefontsize, false); window.addeventlistener("onresize", changefontsize, false); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -