Webcontrol calling JavaScript Function

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?
 
M

Masudur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top