As the Javascript can only be executed on the client machine you cannot "call" it as such from your code-behind. You can however render a call to the function to the response stream and get the client to execute when the page loads. The framework provides classes for handling this in Page.RegisterClientScriptBlock.
Basically you need to build a string of clientscript (including the tags) and add this to the response something like below.
but doesn't that just add sScript to my page, so that it will run on render?
i already have the script on my page. it looks like this:
<script language="javascript">
function displayPopup(text)
{
alert(text);
}
</script>
at the moment, when somebody fills out my form then presses okay, i change some text on a label to say thankyou. i would rather call this function to say thankyou in a pop up bax.
____________________________________________________
If you like a post, show you care by giving it a <censored>.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.