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 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    target frame in asp

    I have a nav system that sits in a frame.

    Yes I do knkow how bad frames are but this is what I have to work with.

    This is set out as below

    _________________
    | nav |
    |________________|
    | |
    | |
    | main |
    | |
    | |
    ----------------------------

    What I need to do is get the name of the main page search the string for a folder name then use that to determine what section the user is in. The appropriate navigation item can then be highlighted using this information.

    This should be easy enough using
    Request.ServerVariables("SCRIPT_NAME")

    This howevr returns the value of the nav frame and I want the value in the main frame.

    Is there a way to do this in .asp whithout having to
    put .asp code on every page loaded in to the main frame of the site to pull in the SCRIPT_NAME value.


    Or would I be better
    A. Use Javascript completely

    B. Use Javascript but pass the value to .asp (not sure how I would do this)

    Thank You for any help in advance.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please don't double-post; I've deleted this thread's duplicate.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you mean you've got a "search" form on the Nav window?

    If so, you'll need client side javascript triggered by the submit event to fetch the name of the URL of the Main frame, place it into a hidden field that's part of your search form and then that can be submitted to your ASP script which can then use the URL from that form field to know where the user is at.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #4
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I think he means that he wants to get the value of "SCRIPT_NAME" and then search the value for a folder, e.g. /gallery/default.asp, so he can identify the section the user is browsing, in the example it's the gallery.

    I have no idea how to do it, but now that people may understand better, they might be able to help.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    If that's the case, then use:

    top.frames['main'].location.pathname

    Assuming the url of the main frame is:

    http://www.mydomain/etc/gallery/default.asp?somequery=somevalue

    ...the pathname returned is:

    etc/gallery/default.asp

    and then from there, you can extract the path without the filename.

  • #6
    New Coder
    Join Date
    Feb 2003
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your help.

    What I wanted to do was find the folder that the bottom frame was in so as I could use that information to highlight the appropriate section in my navigation.

    This is what I came up with. Its a combination of asp and javascript that is used to pull in the url of the bottom frame. This is then stored in a hidden text box and then submitted to the same page. This way I now am able to access the bottom frame url with asp.

    If the url is blank ie if it has been submitted or not set then
    doSubmit = "do"

    This is required as urlPull is done onLoad in the body page by removing this step the form constantly submits.

    Code:
    <% 
    dim sUrl, doSubmit
    
    sUrl = Request.Form("url")
    
    if sUrl = "" then 
      doSubmit = "do"
    end if
    %>
    <script language="JavaScript">
    
    function urlPull()
    {
    doSubmit = "<%=doSubmit%>"
    
      if (doSubmit == "do")
      {
        document.urlForm.url.value = parent.main.location.href;
        document.urlForm.submit();
      }
    }
    
    </script>

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    You can also use:

    document.urlForm.url.value = parent.frames.main.location.pathname;

    so that it's easier for the server to extract the path.


  •  

    Posting Permissions

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