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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving URL parameter using VBScript (non-ASP system)

Status
Not open for further replies.

waynea

Programmer
Jul 11, 2000
41
0
0
US
Anybody know how to do this, or if it can be done?
 
Need more detail.

What non-ASP system?

What URL parameter?

Could this be static HTML pages with script in them that want to get at something like their own query parameters?

Is this close?

locstuff.htm
Code:
<html>
  <head>
    <title>document.location.*</title>
    <style>
      p    {color: black; font: normal 12pt sans-serif}
      div  {color: red;   font: bold   12pt monospace}
      span {color: black; font: normal 10pt monospace}
    </style>
    <script language=&quot;VBScript&quot;>
      Sub window_onload()
        With document.location
          spanHref.innerText = .href
          spanProt.innerText = .protocol
          spanHost.innerText = .host
          spanPath.innerText = .pathname
          spanSear.innerText = .search
        End With
      End Sub
    </script>
  </head>
  <body>
    <p><a href=&quot;locstuff.htm?123;params;321&quot;>Click me</a></p>
    <div>HREF..... [<span id=&quot;spanHref&quot;></span>]</div>
    <div>Protocol. [<span id=&quot;spanProt&quot;></span>]</div>
    <div>Host*.... [<span id=&quot;spanHost&quot;></span>]</div>
    <div>Pathname. [<span id=&quot;spanPath&quot;></span>]</div>
    <div>Search... [<span id=&quot;spanSear&quot;></span>]</div>
    <p>* &quot;Host&quot; is empty for file URLs</p>
  </body>
</html>
Copy/paste above into a file called locstuff.htm, then save it. Double-click on the file to open it in IE.

Click on the &quot;Click me&quot; link to reload the page with query parameters, notice the change displayed.
 
That's it! Thanks. I knew there had to be a way to do that, but could find *no* reference in my books.

Basically, it's a simple little page that has a single 1-character parameter in the URL that I need to reference in order to include a page in the body.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top