【问题标题】:open another page on main page if a button from embedded page is clicked如果单击嵌入页面中的按钮,则在主页上打开另一个页面
【发布时间】:2020-05-05 17:39:10
【问题描述】:

我在主页上嵌入了登录和登录页面。但我想要的是,如果在登录页面上单击提交,则应该打开一个新页面“关于” - 不是嵌入页面,而是主页转到关于页面。

在我尝试通过 jquery 将页面加载到主页但代码根本不起作用之前

主页


<body>
    <header>

        <div class="btn"><button class="login">login</button><button class="sign">signup</button></div>
<div class="login" id="log" name="Login">

     <embed src="login.html" class="login hidden" style="width:45%; 
     height:auto !important; border:none;"></embed>


</div>
<div class="signup">
       <embed src="signup.html" class="signup hidden" 
        style="width:50%; height:50% !important; border:none;" 
       scrolling="no"></embed>

<script type="text/javascript">





$('button.login').on('click',function(){

    $('embed.login').removeClass('hidden');
    $('embed.signup').addClass('hidden');   
}); 


$('button.sign').on('click',function(){
    $('embed.signup').removeClass('hidden');
    $('embed.login').addClass('hidden');


});



</script>


登录页面代码

<body>
<form class="hidden login" name="Log"><input type="email" name="email" placeholder="enter email" required>
        <input type="password" name="password" placeholder="enter password" required>
        <button > submit</button>
    </form>

【问题讨论】:

    标签: jquery html css hyperlink load


    【解决方案1】:

    尝试以下方法:

    $('form[name=  "Log"]').on('submit',function(){
        window.location = 'about.html'; //or whatever is the name of the html file
    });
    

    【讨论】:

    • 我的登录页面嵌入在主页中我希望如果有人从登录的嵌入页面登录然后从主页用户转到关于不在嵌入部分的页面
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-19
    • 2015-11-24
    • 1970-01-01
    相关资源
    最近更新 更多