Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

很急,bootstrap里form样式的div里的按钮,为什么不能跳转?

<div id="loginModal" class="modal show">
    <div style="height: 50px;"></div>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close">x</button>
                <h2 class="text-danger text-center">标题</h2>
                <h3 class="text-center text-primary">用户登录</h3>
            </div>
            <div class="modal-body">
                <form  class="form col-md-12 center-block">
                    <div class="form-group">
                        <input id="username" type="text" class="form-control input-lg" placeholder="username">
                    </div>
                    <div class="form-group">
                        <input id="password" type="password" class="form-control input-lg" placeholder="password">
                    </div>
                    <div class="form-group">
                        <button id="btn-login" class="btn btn-primary btn-lg btn-block">立刻登录</button>
                        <button id="btn-goRegister" class="btn btn-danger btn-lg btn-block">注册</button>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                    <button id="test" class="btn btn-primary">test</button>
            </div>
        </div>
    </div>
</div>

bootstrap弄的一个登录页面样式,用的form样式的div 点击'注册'按钮想跳转到注册页面 可是无法跳转

下面写了一个test的按钮 可以跳转

跳转方式就是js写的window.location.href

请问这种情况怎么调整

找到具体问题了 : 中间<form> 里的按钮不能直接跳转 </form> 把form改成div可以直接跳转了 可是这样页面样式不太对劲了 毕竟用的bootstrap的样式


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

加上type="button"试试


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...