Set button icon using javascript

How to set an icon of a button?
For example, how to set the icon of a button named 0015 to "c:\images\dummy.jpg"?
I might need to change the button to "Icon only" prior to that.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Karl Heinz KremerCommented:
You open up the button properties dialog, then go to the "Options" tab:

Button Properties - Icon
You can now select one of the layout options that uses an icon, once that is done, the "Choose Icon..." button will become available, and you can navigate to your icon file.
Karl Heinz KremerCommented:
Oops - Update: I just realized that you want to do this with JavaScript

To do that you (as you correctly suggest) will have to change the layout mode first using the "buttonPosition" property of your field. See here for more information:

To import the image, you would use buttonImportIcon():

If you want to specify a path, there are security implications: You can only do that during a batch or a console event.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.