I have some javacript that I am trying to implement on an HTML page. The code is below - how can I get it to run as soon as the .html file is opened? It want it to prompt me to enter the weight as soon as i open it.
<script type="text/javascript">
    var weight = parseInt(prompt("What is your weight?"));
    if (weight > 126) {
        alert('Please enter a weight lighter than 126');
    }
    document.writeln('<br/>');
    var wArray = ["fly", "superfly", "bantam", "superbantam", "feather"];
    function recruit() {
        if (0 < weight < 112){
            document.writeln('You are in' + wArray[0] +'class!');
        }
        if (112 < weight < 115){
            alert('You are in' + wArray[1] +'class!');
        }
        if (weight > 115 && weight < 118){
            alert('You are in' + wArray[2] +'class!');
        }
        if(weight > 118 && weight < 122){
            alert('You are in' + wArray[3] +'class!');
        }
        if (weight > 122&& weight < 126){
            alert('Your weight class is' + wArray[4]);
    }
</script>
 
     
     
     
     
     
    