gpt4 book ai didi

javascript - 功能在 Safari 中不起作用

转载 作者:行者123 更新时间:2023-11-28 02:48:31 25 4
gpt4 key购买 nike

以下功能在 FireFox 和 Internet Explorer 中有效,但在 Safari 中无效。在 Safari 中,当您单击时什么也不会发生。

如何修复该功能以使其在 Safari 中也能正常工作?

我已检查 JavaScript 是否已启用(已在 3 台不同的机器上进行了测试)。

非常感谢

<script>
function win() {
$("#main").remove();

$("#content_target").html('<div style="z-index:2;background:url(img/frame_main.png) no-repeat;text-align:left;width:726px;height:491px;"><div id="target" style="padding:5% 5%;float:left"></div> </div>');

$("#target").load("myphp.php", {variable1: "myvariable", variable2: 12}, function(){

$("#my_div").css('background', 'url("img/img_ACTI.png") no-repeat');
});
}
</script>

<div onclick="javascript:win();" ><a href="#">Click me</a></div>

最佳答案

尝试一下,将该函数放入点击触发器中...

<script>
function win() {
$("#main").remove();

$("#content_target").html('<div style="z-index:2;background:url(img/frame_main.png) no-repeat;text-align:left;width:726px;height:491px;"><div id="target" style="padding:5% 5%;float:left"></div> </div>');

$("#target").load("myphp.php", {variable1: "myvariable", variable2: 12}, function(){

$("#my_div").css('background', 'url("img/img_ACTI.png") no-repeat');
});
}

$("#clickMe").click(function(){
win();
});
</script>

<div id="clickMe" ><a href="#">Click me</a></div>

关于javascript - 功能在 Safari 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4324523/

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