<a href=""> not working on the other pages

时间:2017-08-07 00:16:51

标签: javascript jquery html twitter-bootstrap

Here's the first page that the a href='' code is working .

moneypro.online/website-design

<div class="row animate-box fadeInUp animated-fast">
            <!-- Tabs -->
        <div class="gtco-tab-content tab-content animated-fast active fadeIn" data-tab-content="1">
            <div class="col-md-6">
                <div class="gtco-video gtco-bg gtco-image img-responsive" style="background-image: url(/WebsiteDesign.png); background-size: contain; ">
                </div>
            </div>
            <div class="col-md-6">
               <h2>Website Design</h2>
                        <p>As a business start with an idea, an online identity starts with a design concept. Here at Euro ITS we listen to client business goals and incorporate it within our design. Together with our knowledge of digital marketing, our website designs are: </p>
                        <div class="row">
                            <div class="col-md-12">
                                <h4>✔ Responsive</h4>
                            </div>
                            <div class="col-md-12">
                                <h4>✔ User oriented</h4>
                            </div>

                            <div class="col-md-12">
                                <h4>✔ Search engine ready</h4>
                            </div>
                        </div>
                <div class="row">
                    <div class="col-md-4">
                        <a href="/contact"><button type="button" class="btn btn-success btn-block">Appointment</button></a>
                    </div>
                    <div class="col-md-4">
                        <a href="#"><button type="button" class="btn btn-info btn-block">Inquiry</button></a>
                    </div>
                    <div class="col-md-4">
                        <a href="/pricing"><button type="button" class="btn btn-warning btn-block">Pricing</button></a>
                    </div>
                </div>
            </div>
        </div>

    </div>

and here is the other page that the a href='' code does not work.

moneypro.online/services

 <div class="gtco-tab-content-wrap" style="height: 643px;" data-section="services">
                <div class="gtco-tab-content tab-content animated-fast active fadeIn" data-tab-content="1">
                    <div class="col-md-6 col-sm-12 col-xs-12">
                        <div class="gtco-video gtco-bg img-responsive" style="background-image: url(assets/public/images/icons/WebsiteDesign.png); background-size: contain; ">
                        </div>
                    </div>
                    <div class="col-md-6 col-sm-12 col-xs-12">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="panel">
                                    <div class="panel panel-heading panel-cust-bg">
                                        <h2 class="cust-txt"><strong>Website Design</strong></h2>
                                    </div>
                                    <div class="panel-body">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <p>As a business start with an idea, an online identity starts with a design concept. Here at Euro ITS we listen to client business goals and incorporate it within our design. Together with our knowledge of digital marketing, our website designs are: </p>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <div class="col-md-12">
                                                <h4>✔ Responsive</h4>
                                            </div>
                                            <div class="col-md-12">
                                                <h4>✔ User oriented</h4>
                                            </div>

                                            <div class="col-md-12">
                                                <h4>✔ Search engine ready</h4>
                                            </div>
                                        </div>
                                    </div>
                                </div>                                
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-4">
                                <a href="/contact" class="btn btn-success btn-block" role="button" >Appointment</a>
                            </div>
                            <div class="col-md-4">
                                <a href="#" class="btn btn-info btn-block" role="button">Inquiry</a>
                            </div>
                            <div class="col-md-4">
                                <a href="/pricing" class="btn btn-warning btn-block" role="button">Pricing</a>
                            </div>
                        </div>
                    </div>
                </div>

they're are exactly the same and i don't know why the other page is working . here's the live website of it live example

有人可以向我解释一下。

2 个答案:

答案 0 :(得分:2)

好的,这是两者之间的区别:

工作:

<a href="/contact">
    <button type="button" class="btn btn-success btn-block">
        Appointment
    </button>
</a>

不工作:

<a href="/contact" class="btn btn-success btn-block" role="button">
    Appointment
</a>

您正在将等级btn添加到&#34; a&#34;标记,它认为标记是一个按钮,因此它忽略了href属性。

答案 1 :(得分:0)

每个href元素都需要一个对应的锚点,该锚点应该是name或id属性,并且必须匹配/存在于页面中。 w3schools This example展示了href的良好做法。