Question 1 :
How can I require that fields be filled in, or filled in correctly?
Have the server-side (e.g., CGI) program that processes the form submission send an error message if the field is not filled in properly. Ideally, this error message should include a copy of the original form with the original (incomplete or incorrect) data filled in as the default values for the form fields. The Perl CGI.pm module provides helpful mechanisms for returning partially completed forms to the user.
Note that the server-side program should not rely upon the checking done by the client-side script.
Question 2 :
How do I change the title of a framed document?
The title displayed is the title of the frameset document rather than the titles of any of the pages within frames. To change the title displayed, link to a new frameset document using TARGET="_top" (replacing the entire frameset).
Question 3 :
How do I link an image to something?
Just use the image as the link content, like this:
<a href=...><img src=... alt=...></a>
Question 4 :
Should I end my URLs with a slash?
The URL structure defines a hierarchy similar to a filesystem's hierarchy of subdirectories or folders. The segments of a URL are separated by slash characters ("/"). When navigating the URL hierarchy, the final segment of the URL (i.e., everything after the final slash) is similar to a file in a filesystem. The other segments of the URL are similar to the subdirectories and folders in a filesystem.
When resolving relative URLs (see the answer to the previous question), the browser's first step is to strip everything after the last slash in the URL of the current document. If the current document's URL ends with a slash, then the final segment (the "file") of the URL is null. If you remove the final slash, then the final segment of the URL is no longer null; it is whatever follows the final remaining slash in the URL. Removing the slash changes the URL; the modified URL refers to a different document and relative URLs will resolve differently.
For example, the final segment of the URL http://www.mysite.com/faq/html/ is empty; there is nothing after the final slash. In this document, the relative URL all.html resolves to http://www.mysite.com/faq/html/all.html (an existing document). If the final slash is omitted, then the final segment of the modified URL http://www.mysite.com/faq/html is "html". In this (nonexistent) document, the relative URL all.html would resolve to http://www.mysite.com/faq/all.html (another nonexistent document).
When they receive a request that is missing its final slash, web servers cannot ignore the missing slash and just send the document anyway. Doing so would break any relative URLs in the document. Normally, servers are configured to send a redirection message when they receive such a request. In response to the redirection message, the browser requests the correct URL, and then the server sends the requested document. (By the way, the browser does not and cannot correct the URL on its own; only the server can determine whether the URL is missing its final slash.)
This error-correction process means that URLs without their final slash will still work. However, this process wastes time and network resources. If you include the final slash when it is appropriate, then browsers won't need to send a second request to the server.
The exception is when you refer to a URL with just a hostname (e.g., http://www.mysite.com). In this case, the browser will assume that you want the main index ("/") from the server, and you do not have to include the final slash. However, many regard it as good style to include it anyway.
Question 5 :
How do I specify a specific combination of frames instead of the default document?
This is unfortunately not possible. When you navigate through a site using frames, the URL will not change as the documents in the individual frames change. This means that there is no way to indicate the combination of documents that make up the current state of the frameset.
The author can provide multiple frameset documents, one for each combination of frame content. These frameset documents can be generated automatically, perhaps being created on the fly by a CGI program. Rather than linking to individual content documents, the author can link to these separate frameset documents using TARGET="_top". Thus, the URL of the current frameset document will always specify the combination of frames being displayed, which allows links, bookmarks, etc. to function normally.
Question 6 :
How do I link to a location in the middle of an HTML document?
First, label the destination of the link. The old way to label the destination of the link was with an anchor using the NAME attribute. For example:
<h2><a name="section2">Section 2: Beyond Introductions</a></h2>
The modern way to label the destination of the link is with an ID attribute. For example:
<h2 id="section2">Section 2: Beyond Introductions</h2>
Second, link to the labeled destination. The URL is the URL of the document, with "#" and the value of the NAME or ID attribute appended. Continuing the above examples, elsewhere in the same document you could use:
<a href="#section2">go to Section 2</a>
Similarly, in another document you could use:
<a href="thesis.html#section2">go to Section 2 of my thesis</a>
Question 7 :
How do I create a link?
Use an anchor element. The HREF attribute specifies the URL of the document that you want to link to. The following example links the text "Web Authoring FAQ" to
<URL:http://www.htmlhelp.com/faq/html/> <A HREF="http://www.yoursite.com/faq/html/">Web Authoring FAQ</A>
Question 8 :
How do I create a link that opens a new window?
<p><a target="_blank" href=...></p> opens a new, unnamed window.
<p><a target="example" href=...></p> opens a new window named "example", provided that a window or frame by that name does not already exist.
Question 9 :
How do I let people download a file from my page?
Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:
<p><a href="../files/foo.zip">Download Foo Now! (100kb ZIP)</a></p>
Question 10 :
How do I create a button which acts like a link?
This is best done with a small form:
<FORM ACTION="[URL]" METHOD=GET> <INPUT TYPE=submit VALUE="Text on button"> </FORM>
If you want to line up buttons next to each other, you will have to put them in a one-row table, with each button in a separate cell.
Note that search engines might not find the target document unless there is a normal link somewhere else on the page.
Question 11 :
How can I make a form with custom buttons?
Rather than a normal submit button (<input type="submit" ...>), you can use the image input type (<input type="image" ...>). The image input type specifies a graphical submit button that functions like a server-side image map.
Unlike normal submit buttons (which return a name=value pair), the image input type returns the x-y coordinates of the location where the user clicked on the image. The browser returns the x-y coordinates as name.x=000 and name.y=000 pairs.
For compatability with various non-graphical browsing environments, the VALUE and ALT attributes should be set to the same value as the NAME attribute. For example:
<input type="image" name="Send" alt="Send" value="Send" src="send-button.gif">
Question 12 :
How do I specify page breaks in HTML?
There is no way in standard HTML to specify where page breaks will occur when printing a page. HTML was designed to be a device-independent structural definition language, and page breaks depend on things like the fonts and paper size that the person viewing the page is using.
Question 13 :
How do I remove the border around frames?
Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is <p><FRAMESET ... BORDER=0 FRAMEBORDER=0 FRAMESPACING=0></p>.
Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it difficult to resize it, as this border is also used in most GUIs to change the size of the frame.
Question 14 :
Which should I use, &entityname; or &#number; ?
In HTML, characters can be represented in three ways:
1. a properly coded character, in the encoding specified by the "charset" attribute of the "Content-type:" header;
2. a character entity (&entityname;), from the appropriate HTML specification (HTML 2.0/3.2, HTML 4, etc.);
3. a numeric character reference (&#number;) that specifies the Unicode reference of the desired character. We recommend using decimal references; hexadecimal references are less widely supported.
In theory these representations are equally valid. In practice, authoring convenience and limited support by browsers complicate the issue.
HTTP being a guaranteed "8-bit clean" protocol, you can safely send out 8-bit or multibyte coded characters, in the various codings that are supported by browsers.
A. HTML 2.0/3.2 (Latin-1)
By now there seems no convincing reason to choose &entityname; versus &#number;, so use whichever is convenient.
If you can confidently handle 8-bit-coded characters this is fine too, probably preferred for writing heavily-accented languages. Take care if authoring on non-ISO-8859-based platforms such as Mac, Psion, IBM mainframes etc., that your upload technique delivers a correctly coded document to the server. Using &-representations avoids such problems.
B. A single repertoire other than Latin-1
In such codings as ISO-8859-7 Greek, koi8-r Russian Cyrillic, and Chinese, Japanese and Korean (CJK) codings, use of coded characters is the most widely supported and used technique.
Although not covered by HTML 3.2, browsers have supported this quite widely for some time now; it is a valid option within the HTML 4 specifications--use a validator such as the WDG HTML Validator or the W3C HTML Validation Service which supports HTML 4 and understands different character encodings.
Browser support for coded characters may depend on configuration and font resources. In some cases, additional programs called "helpers" or "add-ins" supply virtual fonts to browsers.
"Add-in" programs have in the past been used to support numeric references to 15-bit or 16-bit code protocols such as Chinese Big5 or Chinese GB2312.
In theory you should be able to include not only coded characters but also Unicode numeric character references, but browser support is generally poor. Numeric references to the "charset-specified" encoding may appear to produce the desired characters on some browsers, but this is wrong behavior and should not be used. Character entities are also problematical, aside from the HTML-significant characters <, & etc.
C. Internationalization per HTML 4
Recent versions of the popular browsers have support for some of these features, but at time of writing it seems unwise to rely on this when authoring for a general audience.
Question 15 :
Is there a way to prevent getting framed?
"Getting framed" refers to having your documents displayed within someone else's frameset without your permission. This can happen accidentally (the frameset author forgot to use TARGET="_top" when linking to your document) or intentionally (the frameset author wanted to display your content with his/her own navigation or banner frames).
To avoid "framing" other people's documents, you must add TARGET="_top" to all links that lead to documents outside your intended scope.
Unfortunately, there is no reliable way to specify that a particular document should be displayed in the full browser window, rather than in the current frame. One workaround is to use <BASE TARGET="_top"> in the document, but this only specifies the default target frame for links in the current document, not for the document itself.
Question 16 :
Why aren't my frames the exact size I specified?
Older versions of Netscape Navigator seems to convert pixel-based frame dimensions to whole percentages, and to use those percentage-based dimensions when laying out the frames. Thus, frames with pixel-based dimensions will be rendered with a slightly different size than that specified in the frameset document. The rounding error will vary depending on the exact size of the browser window.
Furthermore, Navigator seems to store the percentage-based dimensions internally, rather than the original pixel-based dimensions. Thus, when a window is resized, the frames are redrawn based on the new window size and the old percentage-based dimensions.
There is no way to prevent this behavior. To accommodate it, you should design your site to adapt to variations in the frame dimensions. This is another situation where it is a good idea to accommodate variations in the browser's presentation.
Question 17 :
How can I specify background images?
With HTML, you can suggest a background image with the BACKGROUND attribute of the BODY element. Here is an example:
<body background="imagefile.gif" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#000080">
If you specify a background image, you should also specify text, link, and background colors since the reader's default colors may not provide adequate contrast against your background image. The background color may be used by those not using your background image. Authors should not rely on the specified background image since browsers allow their users to disable image loading or to override document-specified backgrounds.
Question 18 :
How can I copy something from a webpage to my webpage?
1: Plaintext or any text information viewable from your browser can be easily copied like any other text from any other file.
2; HTML and web scripts - you will need to view the web page's source code. In the page's source code, copying the tags as well as all the information in-between these tags will usually enable the script to work on your web page.
3: Images, sounds, or movies - Almost all images, sounds, and movies can be copied to your computer and then viewed on your webpage. Images can be easily copied from a webpage by right-clicking an image and selecting "Save Picture as" or "Save Image as". Unless the sound or movies file has a direct link to download and save the file to a specified location on your hard disk drive or to view your Internet browser's cache and locate the sound or movie file saved in the cache.
4. Embedded objects - Looking at the source code of the object to determine the name of the file and how it is loaded, and copy both the code and the file.
Question 19 :
Is it possible to make the HTML source not viewable?
In short, there is no real method or script for making standard HTML source code not viewable. You may consider doing any of the below if they are concerned about your source code.
1. Create the web page in Macromedia Flash or a similar program. The visitor would need to download the Macromedia Flash plug-in and would be unable to view the source code for the flash applet.
2. There are various scripts that will disable the right click feature, preventing the user from saving images or viewing the source. However, this will not protect the source code of your page. For example, Internet Explorer users may still click "View" and "Source" to view the source code of the page, or a user could disable scripts and images can be saved by simply saving the web page to the hard drive.
3. There are several programs that will help scramble your code, making it difficult (not impossible) to read. Again, this is not going to prevent someone from viewing your code.
Question 20 :
Why doesn't my title show up when I click "check it out"?
You're probably looking at the wrong part of the screen. The Title usually shows up in the Title Bar on the Window, to the left of the minimize/maximize buttons on graphical browsers.