Top Ten HTML-Related Questions

1. How do I make my page automatically jump to another page after a specified time?

A derivative of the META tag is used for redirecting users to another page after a specified amount of time. Simply include the following tag in your page, where x is the number of seconds to wait until redirection, and http://www.someurl.com/ is the URL that the user is being directed to. (The tag must be placed between the <head> and </head> tags.)

You'll need to know what Web server you're running. If you're running Apache (the most popular Web server in use today), use the instructions below. However, if you're running any other Web server, consult the manufacturer's documentation to find the answer to this oft-asked question.

Here are instructions for creating a directory named protected to hold files protected by a username and password. This new directory will be created as a subdirectory under the current directory. For security reasons, the file containing user passwords will be created in the top level of your home directory (outside of your Web document tree).

Log into your account via telnet.

Create your protected directory:

mkdir protected

In your new directory, create a text file named .htaccess to tell the Web server that this directory is going to require user names and passwords. The leading period in the file name will make this a hidden file.

Go to your protected directory:

cd protected

To create your .htaccess text file:

pico .htaccess

Note: You can substitute your favorite editor in place of pico in the above instruction.

Enter the following lines into your text file, replacing username with your own username and /users/username/passfile as the top level of your home directory, outside of the directory structure accessible from the Web:

Go to the directory you specified for AuthUserFile /users/username/passfile earlier:

cd

Create the password file named passfile:

htpasswd -c passfile userid

In the above command, replace userid with the name that you want to add to the list of allowed users. Htpasswd will then ask you to create and verify the user's password. To add a user to an existing file or to change a user's password, just omit the -c option.

That should do it! Any hyperlink to the protected directory or any of its files should prompt the browser to ask for a user name and password.

3. How do I make an image change when the user's mouse moves over it?

Simply use the tutorial linked here for information on JavaScript mouseovers. For further teachings about JavaScript, see our JavaScript tutorial.

4. What's a table good for?

Tables are useful both as an easy way to display tabulated information, and more commonly, as a page layout tool. The layout on this very page was created with a full-page table.

For more information on tables, including page layout tips and general instructions on syntax, click here.