Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modify onclick cb event

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
US
Hi.

I found this onclick function that I want to use.
I want to be able to pass a variable
in the onclick='CBClicked(this, myvar); into the function.
and modify it so the alert box shows the input variable?

thanks



Code:
onclick='CBClicked(this);


 function CBClicked (theBox){ 
      if (!theBox.checked) 
         alert ("Unchecked."); 
      else 
         alert ("Checked."); 
   }
 
Duhh I got it.
I was making it harder than it was


onclick='CBClicked(this," & rssearch("indx") & ");

function BClicked (theBox,myval){
if (!theBox.checked)
alert (myval);
else
alert ("Checked."); }

 
Code:
onclick="CBClicked(this[!], someVar[/!]);"


 function CBClicked (theBox[!], someVar[/!]){
   [!]alert(someVar);[/!]
      if (!theBox.checked)
         alert ("Unchecked.");
      else
         alert ("Checked.");
   }

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Dan,


Thanks. I must have figured it out just before you posted.

I got it working.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top