当用户按下没有php页面的提交按钮时,我可以收到消息吗?

I'm kind of new to web designing and in my class we're doing a form. Because of that we recently started we haven't used php pages or scripts.

I want a message to be displayed when the user clicks the submit button. Can this be done without a php page?

Instead of an input element with type="submit", consider using a normal button with an onclick attribute. Do not specify any action attribute for the <form> element.

<form>
  <input id="usn" type="text" placeholder="Username" />
  <input id="psw" type="text" placeholder="Password" />
  <input type="submit" onsubmit="myFunction()" />
</form>
<script type="text/javascript">
  function myFunction() {
    var username = "The username you entered is: " + document.getElementById('usn').value + ". ";
    var password = "The password you entered is: " + document.getElementById('psw').value + ". ";
    alert(username + password);
  }
</script>