Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7653873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:08:06+00:00 2026-05-31T12:08:06+00:00

How to dynamically change the image of a toolbarbutton with javascript? I try this

  • 0

How to dynamically change the image of a toolbarbutton with javascript?

I try this :

<toolbarbutton id=""  oncommand="this.style.listStyleImage= 'url(green-chrono.png)';alert('boom');" label="Menu-button" type="menu-button" style="list-style-image: url(chrono.png);">
        <menupopup id="edit-popup1">
            <menuitem id="toto" label="Accéder à la pointeuse"/>
            <menuitem id="recap" label="Accéder au récapitulatif des heures"/>
        </menupopup>
    </toolbarbutton>

But it doesn’t work, when I click on the button, the picture disappears.

images and xul file are in the same directory.

Thanks for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:08:07+00:00Added an answer on May 31, 2026 at 12:08 pm

    In general the approach is correct but you are using a relative URL. Relative URLs are resolved relative to the stylesheet – so if chrome://myextension/skin/style.css uses the relative URL green-chrono.png the browser will load chrome://myextension/skin/green-chrono.png. In the case that you have here there is no external stylesheet however meaning that the URL will be resolved relative to the XUL document. I guess that this XUL code is located in the browser window – meaning that the URL chrome://browser/content/green-chrono.png is loaded and it doesn’t exist of course. The solution: specify the absolute URL instead of a relative one, e.g.:

    this.style.listStyleImage = 'url(chrome://myextension/skin/green-chrono.png)';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I have a simple Image component, I change its source dynamically on creation. myimg.source
How do I dynamically change the height of a div. Why does this not
I'm using the After Effects CS3 Javascript API to dynamically create and change text
All, I'm trying to dynamically change the image displayed on the thumb of the
I'm writing code this week to dynamically change the color of images. As long
I'm using jQuery to dynamically change the background image on a div. Here's my
If all I want to do is just change an image dynamically, then is
I am having issues of having an image change dynamically. Some background info: I
I’m having some difficulties trying to dynamically change an image. <a href=#no-reload id=dropMenuButton49 class=dropMenuButton>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.