Firefox不会更改图像源 [英] Firefox won't change image source

查看:54
本文介绍了Firefox不会更改图像源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过更改元素的src属性来更改JavaScript + Prototype中的图像。它在IE中运行良好,但在Firefox中不行。我没有收到任何错误,脚本在执行此位后继续执行:

I'm trying to change an image in JavaScript+Prototype by changing the "src" attribute of the element. It works fine in IE, but not in Firefox. I don't get any errors and the script continues executing after this bit executes:

var image = $('toggle');
image.setAttribute("src", "../images/icons/icon_minus.gif");
image.setAttribute("alt", "Minus Symbol");
image.setAttribute("title", "Collapse tree");

我做错了什么?如何使浏览器用icon_minus.gif替换现有图像icon_plus.gif?我确定它一定是非常明显的东西,但我无法弄清楚是什么!

What am I doing wrong? How do I make the browser replace the existing image "icon_plus.gif" with "icon_minus.gif"? I'm sure it must be something really obvious but I can't figure out what!

谢谢

推荐答案

无法弄清楚出了什么问题,但我相信它有可能做到:

Cant figure out what is wrong, but I believe its possible to do a:

image.src = "../images/icons/icon_minus.gif";

BTW,图像路径绝对正确吗?

BTW, is the image path absolutely correct?

这篇关于Firefox不会更改图像源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆