If you wish to programmatically navigate between DHTML pages in your application,
you need to manipulate the BaseWindow
is only logical because, as you will recall, BaseWindow
the browser—and the browser does the navigating between pages.
Assume, for instance, that you supply the user with a button to click. The
button takes the user to another DHTML page furnished by your application. In
the button’s onclick event procedure, you might write the line:
This causes the browser to navigate to the indicated page. Note the name of
the page in the string: It is formed from the project name and an underscore and
the name of the page with an html extension. (This is the name of the temporary
file created for the page on the user’s browser.)
You may also want to persist data between calls to the same page, or to pass
information between pages. Once again, you will call on the browser to help you
with its Property Bag. You use the PutProperty method
to write information to the Property Bag.
Suppose, for example, that you wanted to save information about the state of
a particular element on the DHTML page, just before navigating to another page.
You would make up an appropriate property name, and then you would store a string
value to that property. The code for doing so might look like this:
If optChoiceGreen.Checked Then
PutProperty BaseWindow.Document, "optColor", "Green"
In the example, the programmer has invented a property named
optColor and stored the value "Green" to this property. Note
that the call to PutProperty required three arguments:
Later in vthe same session, the page may be reloaded. If you want to retrieve
the information that was stored for the optColor property,
you could put a call to GetProperty in the
Load event of the DTHTMLPage object:
stroptColor = GetProperty(BaseWindow.Document, "optColor")
By using PutProperty and GetProperty
in tandem, you can cause information about a page to become persistent
across multiple sessions.