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
<META HTTP-EQUIV="refresh" CONTENT="x; URL=http://www.someurl.com/">
For more information on meta tags, see our META tag tutorial.
2. How do I put a password prompt on a page?
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:
- 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:
- To create your .htaccess text file:
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:
AuthType Basic AuthName Protected Access AuthUserFile /users/username/passfile <Limit GET POST PUT> Require valid-user </Limit>
- In pico, exit and save your file:
- Go to the directory you specified for
AuthUserFile /users/username/passfile earlier:
- 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?
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.
5. How do I know if I'm allowed to use CGI on my site?
Contact your Web hosting company.
6. How do I put a counter on my site?
We've got just the thing - click here for a counter.
7. My frames don't show up in Netscape. Why?
Ensure that the
<FRAMESET> tags are all closed with
</FRAMESET>, and that all tags relating to the frames are placed before the
<BODY> tag in the HTML document.
8. How do I get the contents of a form sent to me?
For this function to work correctly, you'll need to use a CGI script such as here for a series of articles and resources geared at promoting your site.
10. How do I make money from my site?
Consult these experts for more information about generating revenue from your Web site. Also take a look at our section on e-commerce.
This article first appeared May 29, 1999.
Contact the WebDeveloper.com® staff