Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Basic Javascript -> Jscript question

    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:

    location="main.htm"

    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>")
    }
    else
    {
    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!
    Sysroom

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    Response.Redirect "/newpage.asp"
    *keep it simple (TM)

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Location
    In front of this computer. (Where else?)
    Posts
    442
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or
    Code:
    Server.Transfer "/newpage.asp"
    Also, you might want to consider some asp/javascript tutorials. See
    here
    Tomorrow is the first day of the rest of your life... What have you done today?
    Tutorials
    Web: w3schools, htmldog General tips: Hardware, Networking

  • #4
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!
    Sysroom
    Last edited by sysroom; 03-26-2005 at 04:18 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •