按钮不在Firefox中工作?

时间:2017-04-28 01:53:25

标签: javascript php

这是我的按钮代码(我的网站中的书籍按钮),它在Firefox中不起作用,但适用于其他浏览器。有什么我可以做的,以使它在Firefox中工作。我知道我不能在我的代码中使用锚点,但我不知道如何摆脱它并使其工作。我试着这样做但它没有用。

这是我的代码;

$thisresult = mysqli_query($con,$sql);

if($booking_info['check_out'] <= date('Y-m-d')){
    echo    "<button style=' ' type='submit'> <a href='booknow.php?id=".$id."'> Book now!</a></button>";
} 
else if(mysqli_num_rows($thisresult)>=1){
    echo "You have already booked this hotel!";
} 
else {
    echo "<button style=' ' type='submit'> <a href='booknow.php?id=".$id."'> Book now!</a></button>"; 
}

}

我很感激帮助, 提前谢谢!

2 个答案:

答案 0 :(得分:1)

您可以使用上述解决方案,或者如果您想坚持使用您的链接。 而不是用(&lt; a href =“#”&gt;&lt; / a&gt;)包裹&lt;按钮&gt;标签 您可以样式(使用css)将您的(&lt; a href =“”&gt;)标记看作按钮

.book-now-btn {
margin-top: 5px;
text-decoration:none; 
padding: 5px 10px;
border: 1px solid #000000;
background: #eeeeee; 
border-radius: 3px; 
color: #000000;
}
<p>
<!-- using inline css -->
<a href="booknow.php?id=1" style="text-decoration:none; padding: 5px 10px; border: 1px solid #000000; background: #eeeeee; border-radius: 3px; color: #000000;"> Book now!</a>

<!-- using class -->
<a href="booknow.php?id=1" class="book-now-btn"> Book now!</a>

</p>

答案 1 :(得分:0)

忽略其他所有内容,您可以将该按钮包装在表单标记中以使其成为&#34;链接&#34;,您还可以为该&#34; id&#34;添加隐藏字段。元素,如果你想。

&#13;
&#13;
<script src="jquery-3.0.0.min.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-
1.4.5.min.js"></script>

<style>
.pop-outer{
background-color: rgba(0,0,0,0.5);
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
}

.pop-inner{
background-color: #fff;
width: 500px;
height: 500px;
padding: 25px;
margin: 15% auto;
}



</style>
<script> 
$("document").ready(function(){
$(".pop-outer").fadeIn('normal');
$(".close").click(function(event){
       event.preventDefault();
        $(".pop-outer").hide();
    });

});
</script>

<body>
<div class="pop-outer">
    <div class="pop-inner ui-btn-icon-notext ui-btn-right">
    <button class="close">X</button>
    <form action="visitor.php" method="post">

    <div class="section"><span>1</span>Basic Information
        <div class="inner-wrap ">
            First Name <input type="text" placeholder="First Name">
            Last Name <input type="text" placeholder="Last Name">
        </div>
    </div>  

    <div class="section"><span>2</span>Contact Information
        <div class="inner-wrap">
            Email Address <input type="email" placeholder="Email Address">
            Telephone Number <input type="number" placeholder="Phone Number">

        </div>  
    </div>

    <div class="section"><span>3</span>Visit Us
        <div class="inner-wrap">
            When do you plan on visiting?<input type="date" placeholder="Select a date">
        </div>  
    </div>

    <div class="section"><span>4</span>Stay Connected
        <div class="inner-wrap">
            Would you like to added to our email list?<br>
                <input type="radio" name="emailblast" value="Yes"> Yes! I would love to be connected with Hopewell!
                <input type="radio" name="emailblast" value="No"> No. I am not interested.</label>
    </div>  
        </div>

        <div class="button-section">
            <input type="submit">
         </div> 
    </form>
    </div>
</div>
&#13;
&#13;
&#13;