Calling functions?

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello, I wrote a jscript function within the HTML window of my webpage and
would like to call it from inside the ASPX code-behind page. Any
suggestions?

or

I would like to cause an alert box to pop up using the code-behind window of
an ASPX page.

Any of these two things will work for me.


Thanks
Chuck
 
Hey Chuck,

What you are trying to do doesn't really make any sense :) Code behind
executes on the server, jscript runs on the client. The two don't have
anything to do with each other. Your only hope might be to have code behind
make the browser call your jscript function to open up the alert box by
putting a call to the jscript function in some client-side event like
<body onload=myFunction();>

Otherwise, server-side code cannot effectively call client-side script but
it can cause it to be called. (if that makes sense).

Good luck,
Graham.
 
Hello Chuck

What about ...
Response.Write("<script language='javascript'>window.alert('Thankyou for
your message! We will email you shortly.');</script>")

Hope this helps.

Graeme
 
Chuck,

Look into Page.RegisterStartupScript...

This will do all that you need...

jayuya
 
Back
Top