Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javscript to ASP

Status
Not open for further replies.

topcat1a

Programmer
Jan 6, 2005
34
GB
Help!

I've written something in Javascript and I need it to be executed on the server. Before the page is given to the user.

Does anyone have any idea how i can do this?
 
Can I add <%%> round the script and set the language to JavaScript then some small changes (document.write to response.write) and hope for the best?
 
If anyone is interested: I have been looking to see how to do this.

It looks like when using JavaScript in an ASP page treat it as if you where writing it in any other run of the mill page. Which his nice.

But the second you want to know anything about the page your working in (as in the place the ASP sits) i.e. document.ANYTHINGELSE it all goes horribly wrong.

You can’t get access to these variables, which is not good

I had a look on some other sites and some people are recommending getting involved with setting up some AJAX on the desired page or you could send over what value you need in a hidden field.

This last suggestion sort of makes sense and I’m going to try this out

I’ll let you know if I get anywhere

Oh well
 
Remember that server-side code executes before the HTML is rendered so page elements will not be available to the script.
As far as I know the ASP server has to be setup to provide server-side JScript and I do not think it is set to do so by default. You may have to alter the server to provide for server-side scripting other than VBScript.

What is it you need to do server-side?
You can always create your HTML via the server-side code and thereby ensure it is available but you are not going to be able to do a lot of processing of the page after the HTML is rendered.


At my age I still learn something new every day, but I forget two others.
 
thanks for the help, I think i have found a way around the problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top