Webcontrol calling JavaScript Function

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

Anyone have an example of a webuser control with a checkbox that passes
information to a JavaScript function on the same page?
on the page I have a checkbox and a textbox (both are server controls).

I want for texbox(server control) information to be passed to the
JavaScript Function WHEN the checkbox (server control) is clicked.

Any examples of this?
 
Anyone have an example of a webuser control with a checkbox that passes
information to a JavaScript function on the same page?
on the page I have a checkbox and a textbox (both are server controls).

I want for texbox(server control) information to be passed to the
JavaScript Function WHEN the checkbox (server control) is clicked.

Any examples of this?

*** Sent via Developersdexhttp://www.developersdex.com***

in Page load of code behind...

CheckBox1.Attributes.Add("onClick", "SomeFunction('" TextBox1.ClientID
+ "');");

In page...

<script language=javascript type="text/javascript">
function SomeFunction(textboxid)
{
if(Checkbox1.checked)
var Text = document.getElementById(textboxid).value;
}
</script>

thanks
 
Back
Top