Password that changes daily having errors?

I made a script that (should) change the password daily using an array of passwords for each day, but I keep getting all sorts of errors.

<script>
</script>
<form>
  <input type="text" placeholder="Username" id="text1" /><br>
  <input type="password" placeholder="Password" id="text2" /><br>
  <input type="button" class="button4" style="background-color:#9c9c9c" value="Login" onclick="javascript:validate()" />
</form>
<script type="text/javascript">
  type = "text/javascript"
  window.onload = function() {
    chgDailyImg();
  }

  function chgDailyImg() {
    var imagearray = new Array();
    imagearray[0] = "9G7DcwnWafg*EtMH";
    imagearray[1] = "MDe^5qHTG#P9dHBm";
    imagearray[2] = "h%$u@2Nfu8FL9H+R";
    imagearray[3] = "X&NB5tYdUs5u@G#z";
    imagearray[4] = "k#Rc3LGsCdu4q%qZ";
    imagearray[5] = "!$p!Ss5BA%#4zeAa";
    imagearray[6] = "qz63!tue3WCUxJ@R";

    var d = new Date(); /*** create a date object for use ***/
    var i = d.getDay();
  function validate() {
    if (document.getElementById("text1").value == "student21" &&
      document.getElementById("text2").value == imagearray[i]) {
      console.log("RIGHT")
    } else {
      console.log("WRONG")
      }
    }
  }

</script>

Mainly, it keeps saying that "validate" is not defined...

"<a class='gotoLine' href='#41:132'>41:132</a> Uncaught ReferenceError: validate is not defined"

OR

"<a class='gotoLine' href='#65:49'>65:49</a> Uncaught ReferenceError: imagearray is not defined"



Read more here: https://stackoverflow.com/questions/66994745/password-that-changes-daily-having-errors

Content Attribution

This content was originally published by html_java at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: