-
Checkbox and Images...
Where can I find a script that would allow when someone hits a checkbox that an image that is associated with that checkbox appear in my <div> area?
-
-
This is basically the same as a mouseover/rollover image script.
The action of a rollover image is based on the "onmouseover" property of an img tag:
<img onmouseover=".....">
For this, you want a similar property, that happens to be somewhere else on the page:
<input type="checkbox" oncheck="...">
The problem is that oncheck does not exist:
So, you will need to fake it. There are two ways:
--For both, you will need to use the property this.checked to see if it is checked (as opposed to unchecked):
if (this.checked) { dothis(); }
1. onclick: this works, but it triggers BEFORE the value is actually changed. So if you use onclick, you will need to find the opposite value for this.checked-- if !(this.checked) (because it has not switched yet).
2. or, slightly simpler, onchange, then it would have already changed the value, so just if (this.checked)
I think onclick will be a more immediate reaction, probably what you want.
So, it should be roughly equivalent to:
<input type="checkbox" onclick="if (!(this.checked)) { dothis(); }">
Where "dothis();" is the same action as the rollover image in the normal script.
http://www.webdeveloper.com/forum/ar...p/t-40285.html
That's some more relevant info if you want to look through it.
I'm not sure what the best, most reliable approach is, though.
Daniel -
Freelance Web Design | <?php?> | <html>| Deutsch | italiano | español | português | català | un peu de français | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks