I want to develop a extension for firefox. Now I add a image in my project, and I want to use it in my js.because my element is created dynamic,so I didn't get it from xul file. How to get the Image in JS directly?
A:
You could use a data: URI. Here's an online generator: http://www.scalora.org/projects/uriencoder/
machine elf
2010-03-19 07:19:16
A:
If your image is in the extension package, for example in yourExtension/chrome/skin, you can access it by chrome URL, like this:
var yourImage = new Image();
yourImage.src = "chrome://yourExtension/skin/yourImage.png";
//do something with yourImage
Manuel Bitto
2010-03-19 23:13:10
I add this in my js file ,but it didn't work ,why? In my css file , I add the same path , it can work!
jin
2010-03-22 05:05:34
any errors from your error console?
Manuel Bitto
2010-03-22 12:21:24