How to Use the VBScript Location Object

Use the location object in VBScript to mark the location of your URL within the code. Each page you set up under your main URL has its own location object, which you can leverage later on in your code to display that page. Use the location object to refresh your current web page, reload the page with a different URL within the location object or use it to gather the name of the current URL. Input a question mark to find a particular URL with the location object.

Instructions

    1

    Use the location objects "href" property to reference the document in your script. Place the string "location.href=document.nameofyourURL.andsubpage.value" in your function, where "nameofyourURL.andsubpage" are exactly that the name of your URL and then put a period between the subpage heading with no spaces. This takes you to your web page when the VBScript performs the function.

    2

    Populate your script with an alternative method if you do not know the "href" property of your URL. Use the established method "toString ()" to return the value of the property in place of the "href" reference in Step 1.

    3

    Write a query in VBScript and include "location" as a variable. The query searches through your web pages for URLs and returns the names to you. Specify in the query if you want the "href" name or the method name returned.

    4

    Assign one URL or many different URLs to go to when a button on your web page is pressed. Enter "location=document.yourform.yourlist.value" into your script. Assign a form and then enter URLs for your list. Include just one or many to display a list of possible URLs.

Blog Archive