gpt4 book ai didi

jquery - 如何让 Firefox 确认我的警报框并等到用户单击 'Okay' 后再转发到下一页

转载 作者:行者123 更新时间:2023-12-01 04:21:18 26 4
gpt4 key购买 nike

有问题的页面在这里: http://ezup.com/csg/gt.html

在 Firefox 中,会触发警报框,但页面会自动转发,无需等待用户的任何输入。这在 IE 和 Chrome 中都有效,只是 Chrome 似乎无法识别 cookie...

    <script type="text/javascript">
$(document).ready(function(){
(".buy > a").click(function(){
//alert($.cookie("firstClick"));
if($.cookie("firstClick") != 1){
$.cookie("firstClick", "1");
alert("You will now be directed to the Shopping Cart page. Please use your browser's back button to return to the CSG store.");
}
else if($.cookie("firstClick") == 1){

}

});
});
</script>

<body>
<ul>
<li class="buy">
<a href="http://store.ezup.eu/ShoppingCart.asp?ProductCode=EC2HSF1010W&ProductCode=EC1010402142T">L
<button type="button">Add to Cart</button>
</a>
</li>
</ul>
</body>

最佳答案

将其更改为确认对话框。或者在函数 http://api.jquery.com/event.preventDefault/ 中添加阻止默认值

<script type="text/javascript">
$(document).ready(function(){
prompt
$(".buy > a").click(function(e){
e.preventDefault();
//alert($.cookie("firstClick"));
if($.cookie("firstClick") != 1){
$.cookie("firstClick", "1");
alert("You will now be directed to the Shopping Cart page. Please use your browser's back button to return to the CSG store.");
window.location = $(this).attr(href);
}
else if($.cookie("firstClick") == 1){

}

});
});
</script>

关于jquery - 如何让 Firefox 确认我的警报框并等到用户单击 'Okay' 后再转发到下一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10234512/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com