View Full Version : Basic Javascript -> Jscript question

03-25-2005, 06:03 AM
Hello All,

I'm just starting to use MS Jscript within ASP. I just want to load an external ASP file into the current window. Normally, I would use this javascript:


However that doesn't seem to work with Jscript. I've tried "window.open" as well. Here's the code:

<%@ LANGUAGE = JScript %>


if (Request.Form ("FirstName") == "")
Response.Write("<center>The first name field is empty.</center>")
location="./content.asp" //show this page in the main window

I've been going nuts! I tried putting the whole page into a "Response.Write" but that gets crazy quickly. I know this is super simple and I'm embarrased to say how much time I've spent looking around for this info before posting.

Thank you so much!

03-25-2005, 12:24 PM
it's not a clientside JS code you need to concentrate on but a serverside one, ie you need to code an HTTP redirect header, like so:

Response.Redirect "/newpage.asp"

03-25-2005, 01:29 PM
Server.Transfer "/newpage.asp"
Also, you might want to consider some asp/javascript tutorials. See
here (http://www.w3schools.com/asp/default.asp)

03-26-2005, 04:10 AM
Thank you very much! That makes total sense that I need to think of it as a pre-hypertext-processor, so it is different from a clientside javascript. No wonder I had a hard time finding the info.

This is the final statement that worked like a charm:

Response.Redirect ("test.htm");

Thanks again guys. Good suggestion for the tutorial too. I had looked at the MS one and it was more of a ref than a tut. W3C does a great job.

Have a great weekend!