兮水.xsh 2023-02-13 16:37 采纳率: 77.8%
浏览 33
已结题

js如何实现点击元素跳转到指定页面?

js如何实现点击图中login.html文件中的input标签,然后跳转到图中的index.html这个页面?求解答。

img

  • 写回答

3条回答 默认 最新

  • allyfireshen 2023-02-13 16:46
    关注

    使用js进行跳转:

    // js
    let submit = document.getElementById("submit")
    submit.onclick = function(){
      window.loaction.href = "../index.html";
      // 或者
      window.open("../index.html");
    }
    
    //jq 
    $("#submit").click(function() {
      window.loaction.href = "../index.html";
      // 或者
      window.open("../index.html");
    })
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 2月21日
  • 已采纳回答 2月13日
  • 创建了问题 2月13日