HighDots Forums  

onClick question

alt.html.tags alt.html.tags


Discuss onClick question in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dellylix
 
Posts: n/a

Default onClick question - 06-10-2004 , 01:46 PM






Hi all,
I've a web form that has a number of fields, one is a checkbox, that if
clicked I want the form to change colour.
but I'm having a blond moment, can anyone point me in the right direction.

The form is a php form by the way, so if there is a php way rather I'm
interested.

Cheers



Reply With Quote
  #2  
Old   
Greg Griffiths
 
Posts: n/a

Default Re: onClick question - 06-10-2004 , 05:31 PM






Try adding an onclick event to the checkbox and then have that change the Style
of the Body element.

dellylix wrote:

Quote:
Hi all,
I've a web form that has a number of fields, one is a checkbox, that if
clicked I want the form to change colour.
but I'm having a blond moment, can anyone point me in the right direction.

The form is a php form by the way, so if there is a php way rather I'm
interested.

Cheers


Reply With Quote
  #3  
Old   
dellylix
 
Posts: n/a

Default Re: onClick question - 06-12-2004 , 04:16 AM



Hi Greg,
That's sorted, I have an onClick tag inside my INPUT field, the reason
It wasn't working was an additional # and a missing ". but once I stood back
and rubbed my eyes It all became clear....

I have another question though, again with the same INPUT tag with the
onClick(document.bgcolor="FFAA00").
If I click the checkbox, the frame changes colour, thats good and proper,
but I also want to return it to the original colour when the checkbox is
unchecked/clicked again.

??


"Greg Griffiths" <greg2 (AT) surfaid (DOT) org> wrote

Quote:
Try adding an onclick event to the checkbox and then have that change the
Style
of the Body element.

dellylix wrote:

Hi all,
I've a web form that has a number of fields, one is a checkbox, that
if
clicked I want the form to change colour.
but I'm having a blond moment, can anyone point me in the right
direction.

The form is a php form by the way, so if there is a php way rather I'm
interested.

Cheers




Reply With Quote
  #4  
Old   
Will Gittoes
 
Posts: n/a

Default Re: onClick question - 06-14-2004 , 04:36 AM



<input ... onClick="SOME_FUNCTION()" ... >


....

function SOME_FUNCTION(){

if(document.FORM_NAME.INPUT_NAME.checked){
document.bgcolor="#FFFFFF"
}else{
document.bgcolor="#000000"
}

}


Or all at once:

<input ...
onClick='if(document.FORM_NAME.INPUT_NAME.checked) {document.bgcolor="#FFFFFF"}else{document.bgcolor= "#000000"}'
... >

(Have it all as one line if your newsreader doesn't like that)

Check my spelling!

Hope that works,
-Will


dellylix wrote:
Quote:
Hi Greg,
That's sorted, I have an onClick tag inside my INPUT field, the reason
It wasn't working was an additional # and a missing ". but once I stood back
and rubbed my eyes It all became clear....

I have another question though, again with the same INPUT tag with the
onClick(document.bgcolor="FFAA00").
If I click the checkbox, the frame changes colour, thats good and proper,
but I also want to return it to the original colour when the checkbox is
unchecked/clicked again.

??


"Greg Griffiths" <greg2 (AT) surfaid (DOT) org> wrote in message
news:40C8E13C.4426B664 (AT) surfaid (DOT) org...

Try adding an onclick event to the checkbox and then have that change the

Style

of the Body element.

dellylix wrote:


Hi all,
I've a web form that has a number of fields, one is a checkbox, that

if

clicked I want the form to change colour.
but I'm having a blond moment, can anyone point me in the right

direction.

The form is a php form by the way, so if there is a php way rather I'm
interested.

Cheers




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.