Displaying Information to the User

See Also

Web pages are filled with information for users, but most of it is static. You can use scripts to display dynamic information to the user.

Displaying Information from Client Scripts

Because client scripts run on the browser, they give you flexibility in how you want to display information to the user. One way is to display message boxes, the way stand-alone applications on a computer often do.

To display message boxes from client scripts

You can also display information from client scripts directly on the page, intermingled with the HTML text.

To display information in the page from client scripts

If your page contains an HTML text box or text area control, you can change the contents of the box to display information.

To display information inside an HTML control

If your application will be running in browsers that support Dynamic HTML (such as Microsoft Internet Explorer 4.0), you can directly set the text of any tag that has a name or ID.

To set the text of a tag using DHTML

To format the text you are displaying, you can include HTML tags, as in the following example:

<SCRIPT LANGUAGE="VBScript">
   document.write "<P>The current time is <B>" & time & "</B></P>"
   document.write "<P>The current date is <B>" & date & "</B></P>"
</SCRIPT>

If the information you want to display includes characters that are reserved in HTML — such as < and > — you cannot directly include them in the string to display.

To display reserved characters

Displaying Information from Server Scripts

To display information to a user from a server script, you usually make it part of the page that is sent to the browser.

To display information on a page from a server script

The server cannot directly display a message box, but a server script can create a client script that displays one.

To display a message box in a server script

If the information you want to display includes characters that are reserved in HTML — such as < and > — you cannot include them in the string to display.

To display reserved characters