Hello!

I got a page which whenever a checkbox is checked I want to insert an image to the right of the check box. Can anyone help?

- realchamp.

Recommended Answers

All 3 Replies

what you could do is preload the image and set its visibility to be hidden, then on the onclick event of the checkbox, you can just set the image to be visible.

OR

you can have a div next to the checkbox, then on the onclick even just change the innerhtml of that div to display an image.

what you could do is preload the image and set its visibility to be hidden, then on the onclick event of the checkbox, you can just set the image to be visible.

OR

you can have a div next to the checkbox, then on the onclick even just change the innerhtml of that div to display an image.

Thanks. I was just testing and it worked perfectly :)

Realchamp,

Another way to do this is to use the "sprite" method.

A sprite is a specially composed background image (in eg a div), which is dynamically offset (horizontally or vertically) by javascript to show one of two or more facets

Sprites are efficient and fun and very well documented on the web.

This would be my preferred way to achieve the effect you want.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.