【发布时间】:2020-09-05 17:00:10
【问题描述】:
所以我有一个简单的脚本可以在单击按钮或选项卡时更改图像。该脚本在 Firefox 中运行良好,但我什至无法在边缘和 chrome 中执行我的脚本中的任何内容。除了一些警告和一些错误之外,控制台日志中没有任何帮助。有人可以帮我解决这个问题吗?
<script type="text/javascript">
jQuery(function($){
$('#specs_button1').click(function() {
$('#the_image').attr('src',templateUrl+'/images/GRAdSpecs/DPS-min.jpg');
});
$('#specs_button2').click(function() {
$('#the_image').attr('src',templateUrl+'/images/GRAdSpecs/FP-min.jpg');
});
$('#specs_button3').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/HP-min.jpg');
});
$('#specs_button4').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/HP_vertical-min.jpg');
});
$('#specs_button5').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/QP_horizontal.jpg');
});
$('#specs_button6').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/QP-min.jpg');
});
$('#specs1').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/DPS-min.jpg');
});
$('#specs2').click(function() {
$('#the_image').attr('src',templateUrl+'/images/GRAdSpecs/FP-min.jpg');
console.log("Button 2");
});
$('#specs3').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/HP-min.jpg');
});
$('#specs4').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/HP_vertical-min.jpg');
});
$('#specs5').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/QP_horizontal.jpg');
});
$('#specs6').click(function() {
$('#the_image').attr('src', templateUrl+'/images/GRAdSpecs/QP-min.jpg');
});
});
</script>
网址:greenreview.com.au/advertise
点击accordin或旁边的按钮时,我想改变图像
谢谢
【问题讨论】:
-
window.onload = jQuery(function($){ window.onload =。
-
哦,啊,我拼命想从这个脚本中获取任何内容到我的页面中,我在 console.log 消息中添加了它。让我清理一下。我的道歉
标签: javascript jquery cross-browser