函數練習登錄功能

<!DOCTYPE html>
<html>
   <head>
      <meta charset="UTF-8">
      <title>登錄功能</title>
      <script type="text/javascript">
         function login(username,password) {
            if(username=='jredu'&&password=='1234') {
               return true;
            } else {
               return false;
            }
         }
         var username=prompt('請輸入用戶名');
         var password=prompt('請輸入密碼');
         alert(login(username,password)?'登錄成功':'登錄失敗')
      </script>
   </head>
   <body>
   </body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章