【发布时间】:2010-06-18 10:40:32
【问题描述】:
我制作了一个使用 jQuery 的网页:http://benmccormack.com/demo/MichaelMassPsalm/Psalm16Mode5.html
当您将组合框中的选择从 Higher Key 更改为 Lower Key 时,所有音乐图像都应该将其源更改为代表低调签名的图像。这在 IE8 中运行良好,但在 Safari、Firefox 或 Chrome 中无法运行。
为什么不呢?
这是我正在使用的 jQuery 代码:
$(document).ready(function () {
$("#musicKey").change(function (event) {
if ($("#musicKey").val() * 1) {
$("img[src*='Low'").each(function (index) {
$(this).attr("src", $(this).attr("src").replace("Low", "High"));
});
}
else {
$("img[src*='High'").each(function (index) {
$(this).attr("src", $(this).attr("src").replace("High", "Low"));
});
}
});
});
【问题讨论】:
标签: javascript jquery html cross-browser