Results 1 to 2 of 2

Thread: Javascript get page (trim url)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Posts
    122

    Javascript get page (trim url)

    On an asp page, I need to get the name of the current page and any parameters and send it as a return url parameter when I navigate to the next page. Basically I need to get the url and trim it to everything after the last "/".

    for examlple, on this page the url is

    http://www.vbforums.com/newthread.ph...ead&forumid=11

    I would need a javascript function that would give me

    newthread.php?s=&action=newthread&forumid=11

    any ideas?

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Try this function.

    Code:
    function GetPageProps(){
    var sUrl = location.href
    var iPos = sUrl.lastIndexOf("/")
    var sResult = sUrl.substring(iPos + 1)
    
    return sResult;
    }
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

Posting Permissions

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



Click Here to Expand Forum to Full Width