Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > pickup variables in URL in simple HTML page and use them in VBscript (ex test.htm?myvar=value)

Reply
Thread Tools

pickup variables in URL in simple HTML page and use them in VBscript (ex test.htm?myvar=value)

 
 
Phil Di Guillielmo
Guest
Posts: n/a
 
      07-23-2003
Hi,
I would like to use a simple HTML page with variables in the URL
example :

test.htm?myvar=value

en then use 'myvar' in VBSCRIPT as follows :

<script language="VBScript">
(? ? ? ? )
.......... msgbox myvar (? ? ? )
</script>


Filip



 
Reply With Quote
 
 
 
 
Joe Fawcett
Guest
Posts: n/a
 
      07-23-2003
" Phil Di Guillielmo" <(E-Mail Removed)> wrote in message
news:bflmlv$it8$(E-Mail Removed)...
> Hi,
> I would like to use a simple HTML page with variables in the URL
> example :
>
> test.htm?myvar=value
>
> en then use 'myvar' in VBSCRIPT as follows :
>
> <script language="VBScript">
> (? ? ? ? )
> ......... msgbox myvar (? ? ? )
> </script>
>
>
> Filip
>
>

Assuming this is client-side then:
msgbox myvar (location.search)

You will have to parse it yourself, I would employ the split function using
'&' to start with and then again using '='.
--

Joe


 
Reply With Quote
 
 
 
 
Phil Di Guillielmo
Guest
Posts: n/a
 
      07-23-2003
Thanks Joe,
since I am not such a expert, the most I can get out of it was :

myUrl = window.document.location.href
msgbox myUrl

can I use some kind of search function (POS, SUBSTR) to cut the URL in
pieces ?
Filip


"Joe Fawcett" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> " Phil Di Guillielmo" <(E-Mail Removed)> wrote in message
> news:bflmlv$it8$(E-Mail Removed)...
> > Hi,
> > I would like to use a simple HTML page with variables in the URL
> > example :
> >
> > test.htm?myvar=value
> >
> > en then use 'myvar' in VBSCRIPT as follows :
> >
> > <script language="VBScript">
> > (? ? ? ? )
> > ......... msgbox myvar (? ? ? )
> > </script>
> >
> >
> > Filip
> >
> >

> Assuming this is client-side then:
> msgbox myvar (location.search)
>
> You will have to parse it yourself, I would employ the split function

using
> '&' to start with and then again using '='.
> --
>
> Joe
>
>



 
Reply With Quote
 
Phil Di Guillielmo
Guest
Posts: n/a
 
      07-23-2003
OK, Joe
I think I am getting somewhere with
'location.search' and the left, right and instr functions.
Greetz,
Phil

"Joe Fawcett" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> " Phil Di Guillielmo" <(E-Mail Removed)> wrote in message
> news:bflmlv$it8$(E-Mail Removed)...
> > Hi,
> > I would like to use a simple HTML page with variables in the URL
> > example :
> >
> > test.htm?myvar=value
> >
> > en then use 'myvar' in VBSCRIPT as follows :
> >
> > <script language="VBScript">
> > (? ? ? ? )
> > ......... msgbox myvar (? ? ? )
> > </script>
> >
> >
> > Filip
> >
> >

> Assuming this is client-side then:
> msgbox myvar (location.search)
>
> You will have to parse it yourself, I would employ the split function

using
> '&' to start with and then again using '='.
> --
>
> Joe
>
>



 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      07-23-2003
" Phil Di Guillielmo" <(E-Mail Removed)> wrote in message news:<bflq2e$l0j$(E-Mail Removed)>...
> "Joe Fawcett" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
> > " Phil Di Guillielmo" <(E-Mail Removed)> wrote in message
> > news:bflmlv$it8$(E-Mail Removed)...
> > > Hi,
> > > I would like to use a simple HTML page with variables in the URL
> > > example :
> > >
> > > test.htm?myvar=value
> > >
> > > en then use 'myvar' in VBSCRIPT as follows :
> > >
> > > <script language="VBScript">
> > > (? ? ? ? )
> > > ......... msgbox myvar (? ? ? )
> > > </script>
> > >
> > >
> > > Filip
> > >
> > >

> > Assuming this is client-side then:
> > msgbox myvar (location.search)
> >
> > You will have to parse it yourself, I would employ the split function

> using
> > '&' to start with and then again using '='.


> Thanks Joe,
> since I am not such a expert, the most I can get out of it was :
>
> myUrl = window.document.location.href
> msgbox myUrl
>
> can I use some kind of search function (POS, SUBSTR) to cut the URL in
> pieces ?


I see you've posted the VBScript groups, but I can't help you with a
VB solution. OTOH, if you could do this with JavaScript, I have this
which may be of use:
http://hyweljenkins.co.uk/programming/js/getnvp.php

--
Hywel
 
Reply With Quote
 
Phil Di Guillielmo
Guest
Posts: n/a
 
      07-24-2003
Thanks, problems solved !!!
100% working !
Filip

--
http://users.tijd.com/fiwi


"Joe Fawcett" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> " Phil Di Guillielmo" <(E-Mail Removed)> wrote in message
> news:bflrj4$it2$(E-Mail Removed)...
> > OK, Joe
> > I think I am getting somewhere with
> > 'location.search' and the left, right and instr functions.
> > Greetz,
> > Phil
> >

> If location.href = http://www.mySite.com/myQuery.htm?name=me&age=40
> sParams = Split(Mid(window.location.search, 2), "&")
> sSearchingFor = "Name"
> bFound = False
> For iLoop = 0 To UBound(sParams)
> sData = Split(sParams(iLoop), "=")
> If UCase(Unescape(sData(0))) = UCase(sSearchingFor) Then
> MsgBox sData(0) & " = " & Unescape(sData(1)), vbInformation,

"Parameter
> found"
> bFound = True
> End If
> Next
> If bFound = False Then
> MsgBox "Parameter not found", vbInformation, "Report"
> End If
> --
>
> Joe
>
>



 
Reply With Quote
 
Aaron J. Scott
Guest
Posts: n/a
 
      08-27-2003
Gees..... Here it is, extensible too.

<Script language="vbscript">
Function GetParameterFromURI(sVarName)
Dim oTempParamCollection, I, sTempString, sURI_Query
sURI_Query = window.location.search
Set oTempParamCollection = CreateObject("Scripting.Dictionary")
sURI_Query = Split(sURI_Query, "&")
For I = 0 To UBound(sURI_Query)
sTempString = Split(sURI_Query, "=")
If UBound(sTempString) = 1 Then
If oTempParamCollection.KeyExists(sTempString(0)) Then
oTempParamCollection(sTempString(0)) =
oTempParamCollection(sTempString(0)) & ";" & sTempString(1)
Else
oTempParamCollection.Add sTempString(0), sTempString(1)
End If
End If
Next
If oTempParamCollection.KeyExists(sVarName) Then
GetParameterFromURI = oTempParamCollection(sVarName)
End If
</Script>

This Function will return multiple occourances of "variable name" as a
semicolon
delimited list of values in the ordinal order of appearance in the url.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpHandlers - Learn Them. Use Them. Anonieko ASP .Net 5 06-16-2006 06:19 PM
launch an exe file from a web page...I use jsp and i cannot use VBScript... dinamointer Javascript 5 05-12-2006 05:46 PM
Cannot get Client Side VBscript variables to ASP.NET page ChucRock ASP .Net 2 04-16-2005 01:13 AM
System.Web.Mail and Pickup Directory =?Utf-8?B?U2FtdWVs?= ASP .Net 2 01-17-2005 02:03 AM
Variables, and how to use them Derek Fountain XML 8 08-21-2003 05:43 PM



Advertisments