Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Checkbox woes

Posted 13 Mar 2002 14:47:01
1
has voted
13 Mar 2002 14:47:01 Mark Wills posted:
Hi guys.

I have a client side behaviour which opens a popup message box when the user clicks (ticks) a check box. I am using the OnClick event at the moment.

Is there anyway I can change this, so that if the user ticks the box, the message is displayed, but if the user UN-CHECKS the box, the message is NOT displayed. If I have to hand code this is JS thats fine, but my JS skills are zero!

Mark

Replies

Replied 13 Mar 2002 17:08:17
13 Mar 2002 17:08:17 Joel Martinez replied:
sure, simply find whatever behavior is being called (the function in the head) and wrap it in an if statement... so if it looks like this <pre id=code><font face=courier size=2 id=code>function alertit()
{
alert("you clicked the checkbox";
}</font id=code></pre id=code>It would look like this<pre id=code><font face=courier size=2 id=code>function alertit()
{
if (document.formname.checkboxname.checked==true)
alert("you clicked the checkbox";
}</font id=code></pre id=code>Notice that the alert will only fire if the checked property is true...

Is this what you where looking for?

Joel Martinez
MX inSite Magazine
The Complete Resource for Macromedia designers & developers
Sign up for your free electronic Preview Issue
www.mxinsite.com
Replied 13 Mar 2002 19:09:33
13 Mar 2002 19:09:33 Mark Wills replied:
Yeah! That's it! You rock! Thanks a lot.

Mark.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
sure, simply find whatever behavior is being called (the function in the head) and wrap it in an if statement... so if it looks like this <pre id=code><font face=courier size=2 id=code>function alertit()
{
alert("you clicked the checkbox";
}</font id=code></pre id=code>It would look like this<pre id=code><font face=courier size=2 id=code>function alertit()
{
if (document.formname.checkboxname.checked==true)
alert("you clicked the checkbox";
}</font id=code></pre id=code>Notice that the alert will only fire if the checked property is true...

Is this what you where looking for?

Joel Martinez
MX inSite Magazine
The Complete Resource for Macromedia designers & developers
Sign up for your free electronic Preview Issue
www.mxinsite.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Reply to this topic