Calling functions?

  • Thread starter Charles A. Lackman
  • 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
 
G

Graham

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.
 
S

Sabre

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
 
J

jayuya

Chuck,

Look into Page.RegisterStartupScript...

This will do all that you need...

jayuya
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top