关于#javascript#的问题:想问一下为什么跳转不页面

<style>
    * {
        margin: 0;
        padding: 0;
    }
    html {
        height: 100%;
    }
    body {
        height: 100%;
    }
    .container {
        height: 100%;
        background-image: linear-gradient(to right, #999999, #330867);
    }
    .login-wrapper {
        background-color: bisque;
        width: 358px;
        height: 588px;
        border-radius: 15px;
        padding: 0 50px;
        position: relative;
        left: 50%;
        top: 50%;
        transform: translate(-50%,-50%);
    }
    .header {
        font-size: 38px;
        font-weight: bold;
        text-align: center;
        line-height: 200px;
    }
    .input-item {
        display: block;
        width: 100%;
        margin-bottom: 20px;
        border: 0;
        padding: 10px;
        border-bottom: 1px solid rgb(128,125,125);
        font-size: 15px;
        outline: none;
    }
    .input-item::placeholder {
        text-transform: uppercase;
    }
    .btn {
        text-align: center;
        padding: 10px;
        width: 100%;
        margin-top: 40px;
        background-image: linear-gradient(to right,#a6c1ee, #fbc2eb);
        color: #fff;
    }
    .msg {
        text-align: center;
        line-height: 88px;
    }
    a {
        text-decoration-line: none;
        color: #abc1ee;
    }
</style>
<script type="text/javascript">
    function start(){
     var inpudE=document.getElementById("on");
    var ege=inpudE.value;
    console.log(ege);
    var inputE=document.getElementById("in");
    var age=inputE.value;
    console.log(age);
    if(age.length>0){
    var indexs=age.indexOf("@");
     if(indexs==-1|| age.indexOf(".")==-1){
      alert("用户名格式异常!");
     }
     else
     {
      if((ege=="123456")&&(age=="zhangsan@163.com"))
      {
       var num=3;
       function countDown(){
        num--;
        if(num>0)
       {
        prompt("登录成功"+num);
       }
       else
       {
        clearInterval(id);
        alert("跳转成功!");
 
       }
 
       }
       var id=setInterval(countDown,1000)
 
 
      }
      else
      {
       alert("用户名或密码错误!");
      }
     }
    }
 
    }
   </script>
登录页面
登录
    </div>
</div>
想问一下为什么跳转不页面

根据提供的代码,无法判断跳转页面的逻辑是否正确。在代码中,并没有找到实现跳转的相关代码。可能需要添加相关代码来实现页面跳转。

如果要实现页面跳转,可以使用JavaScript中的window对象的location属性,将其设置为目标页面的URL地址即可。例如:

window.location = "http://www.baidu.com";


根据提供的代码,无法判断跳转页面的逻辑是否正确。在代码中,并没有找到实现跳转的相关代码。可能需要添加相关代码来实现页面跳转。

如果要实现页面跳转,可以使用JavaScript中的window对象的location属性,将其设置为目标页面的URL地址即可。例如:

javascript
Copy code
window.location = "http://www.example.com%22/;
另外,在代码中还需要注意以下几点:

  • 输入的用户名和密码是否符合要求,例如长度、格式等;
  • 在输入框的HTML代码中没有包含ID属性,可能需要添加ID属性以便在JavaScript中获取输入框的值;
  • 在计时器中使用了prompt()函数,但是该函数不会自动关闭,需要手动关闭,可能会导致代码无法正常执行。建议使用alert()函数替代。
你是套在form表单里面吗?那action里面写啥地址就可以跳转啥
如果只是想通过js跳转 直接写location.href="地址值",
如果想要再表单中提交前进行验证 ,验证完了再跳转 那需要找到表单元素 然后调用其sumit方法
在jquery中可以这么写 $("#表单id值").submit();这句话代表提交表单