call javascript

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

i have a server-side button on my webform and was wondering if i can call an
external javascript that's in the same application direcory?
If so, can someone please show me the syntax?

thanks,
rodchar
 
Put a reference to the .js file in the page HTML. Example:

<script type="text/javascript" src="myscript.js"></script>

Then just use Page.RegisterStartupScript or whatever means you want to add a
script to the page that calls a function or uses data in the external
JavaScript.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
i'm sorry, i wasn't clear on my OP. for the button.click event on the code
behind can i run the javascript from there? if so, how?
 
i'm sorry, i wasn't clear on my OP. for the button.click event on the code
behind can i run the javascript from there? if so, how?

JavaScript is client-side. The only place you're going to be running it is
on the client. So, my answer is the best you're going to get: You can add a
script to the client-side HTML on the server, and run it when the page gets
back to the client.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.
 
Back
Top