/    Sign up×
Community /Pin to ProfileBookmark

Hiding images with <div> tags

Hello.

I am working on a project that requires for a form (image) button to replace an image when a checkbox is checked. In the parent window I have the following code:

<td valign=”middle”>
<div id=”delete-enabled” style=”display: none”>
<input type=”image” src=”delete-off.gif” width=59 height=54 border=0>
</div>
<div id=”delete-disabled” style=”display: visible”>
<img src=”delete-disabled.gif” height=59 width=54>
</div>
</td>

Then in a frame in the parent window, I have the following code:

<script language=”javascript”>
function changebutton()
{
parent.document.getElementsByName(“delete-enabled”)[0].style.display = “visible”;
parent.document.getElementsByName(“delete-disabled”)[0].style.display = “none”;
}
</script>
….
<input type=”checkbox” name=”check1″ onClick=”changebutton();”>

When I check the checkbox I am getting this error:
“Could not get the display property. Invalid argument.”

Does anyone have any ideas as to what is going wrong?
Thanks!
Christine ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@PittimannFeb 22.2005 — Hi!

The most common values for the display property are: 'none', 'block' and 'inline'. You have:

display = "visible";

but 'visible' is a possible value of visibility, not display. That is why you get the error.

Cheers - Pit
Copy linkTweet thisAlerts:
@cmviaauthorFeb 22.2005 — Ah ha! Thanks so much Pit!

I appreciate your quick and helpful response!

Christine ?
Copy linkTweet thisAlerts:
@PittimannFeb 22.2005 — Hi!

You're welcome.

Cheers - Pit ?
×

Success!

Help @cmvia spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...