By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,027 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,027 IT Pros & Developers. It's quick & easy.

Display button when checkbox checked?

P: n/a
I have a form in which I want to have an button(image) displayed next to a
checkbox when it is checked.
If the box is unchecked, the button should disappear.

How can I do this?

Thanks!

Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <AH*************@fe01.usenetserver.com>, "Targa"
<ta*************@alltel.net> writes:
I have a form in which I want to have an button(image) displayed next to a
checkbox when it is checked.
If the box is unchecked, the button should disappear.

How can I do this?

Thanks!


Put a transparent gif there and then use a simple image swap.
--
Randy
Jul 20 '05 #2

P: n/a
"Targa" <ta*************@alltel.net> wrote in message
news:AH*************@fe01.usenetserver.com...
I have a form in which I want to have an button(image) displayed next to a
checkbox when it is checked.
If the box is unchecked, the button should disappear.

How can I do this?

Thanks!

Perhaps?
<html>
<head>
<title>button.htm</title>
<script language="javascript" type="text/javascript">
<!--
function checker(that) {
if (that.checked) {
toggle.style.display = "";
} else {
toggle.style.display = "none";
}
}
// -->
</script>
</head>
<body>
<form>
<input type="checkbox" name="Box" onclick="checker(this)">
<span id="toggle" style="display:none">
<input type="button" value="Button">
</span>
</form>
</body>
</html>
Jul 20 '05 #3

P: n/a
Hey - This works great!

However, I have several fields below the initial checkbox and button. Anyway
to leave those alone?

Thanks!

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:AOsKb.234567$8y1.1054172@attbi_s52...
"Targa" <ta*************@alltel.net> wrote in message
news:AH*************@fe01.usenetserver.com...
I have a form in which I want to have an button(image) displayed next to a checkbox when it is checked.
If the box is unchecked, the button should disappear.

How can I do this?

Thanks!

Perhaps?
<html>
<head>
<title>button.htm</title>
<script language="javascript" type="text/javascript">
<!--
function checker(that) {
if (that.checked) {
toggle.style.display = "";
} else {
toggle.style.display = "none";
}
}
// -->
</script>
</head>
<body>
<form>
<input type="checkbox" name="Box" onclick="checker(this)">
<span id="toggle" style="display:none">
<input type="button" value="Button">
</span>
</form>
</body>
</html>


Jul 20 '05 #4

P: n/a
"Targa" <ta*************@alltel.net> wrote in message
news:ke*************@fe01.usenetserver.com...
Hey - This works great!

However, I have several fields below the initial checkbox and button. Anyway to leave those alone?

Thanks!


Just put
onclick="checker(this)"
on the checkbox(es) you want.

Or are you asking about the movement of those items when the button appears?
If so, then try:

<html>
<head>
<title>buttton.htm</title>
<script language="javascript" type="text/javascript">
<!--
function checker(that) {
if (that.checked) {
toggle.style.visibility = "visible";
} else {
toggle.style.visibility = "hidden";
}
}
// -->
</script>
</head>
<body>
<form>
<input type="checkbox" name="Box" onclick="checker(this)">
<span id="toggle" style="visibility:hidden">
<input type="button" value="Button">
</span>
<br><input type="checkbox" name="Box" onclick="checker(this)">
</form>
</body>
</html>
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.