Professional Documents
Culture Documents
GENERAL
• How to print the current document programmatically?
• Why the browser changes the frame size when I resize the window?
• How can I always load a page from the server and not from the cache?
• Can I prevent the viewer from seeing the HTML source code and saving it?
• What is the character set that can be used with HTML document?
2. From client side you can achieve it by setting memory and disk cache size to ZERO.
Can I have a scroll bar within a table cell?
No, it is not possible to have a scroll bar within a table cell.
What is a KEYGEN tag ?
The KEYGEN tag facilitates the generation of key material and submission of the public key as
part of an HTML form. Syntax for KEYGEN tag is:
<KEYGEN NAME="name" CHALLENGE="challenge">
The following URLs will provide more information on KEYGEN tag:
http://home.netscape.com/eng/security/ca-interface.html
http://developer.netscape.com/docs/manuals/htmlguid/tags2.htm#1076160
Is their a tag to define page breaks?
Currently there are no tags available to define the page breaks or to control the printing operation.
It is possible to print a page with javascript print() method but not to control the operation.
There are some new steps to provide solution to this using CSS Printing Extensions. For more
information refer to CSS Printing Extensions.
Can I prevent the viewer from seeing the HTML source code and saving it?
No, It is not possible to stop the user from viewing the source code directly or from saving the
code to his local disk.
The indirect way is to have a .js file, that writes the document part. Include it in the Script tag and
call this while loading the file.
What is the character set that can be used with HTML document?
HTML uses the ISO 8859-1 (Latin 1) character set for the encoding of documents. Description
about the ISO 8859-1 character set is available at ISO 8859-1 character set overview document.
Can I open mailbox or news components by clicking on the link?
It is possible to open Mail and News components by specifying the URL as 'mailbox:folder' and
'news:folder'.
Sample code:
<a href="mailbox:Inbox">MailBox</a><BR>
<a href="news:netscape-devs-adv-html">Newsgroup</a>
FORMS
• How to disable the ENTER key from activating the form submission?
• How to change dynamically the number of name-value pairs sent to action from a form?
• Can I use 'Accept' attribute with the form input type File?
How to disable the ENTER key from activating the form submission?
This can be achieved by submitting the form using the onClick event handler instead of onSubmit
event handler. It is necessary to return false on event handler onSubmit to prevent submit on
hitting ENTER key.
Sample code:
<FORM NAME="form1" OnSubmit="return false">
<INPUT NAME="entry"> <P>
<INPUT TYPE="submit" VALUE="SubmitForm"
onClick = "document.form1.submit()">
<P>
</FORM>
Is there a way to submit a form and ignore the response?
After submitting the form data to server, it will send the response to the client. This will update
the current display on client side. However it is possible to retain the current display and ignore
the response from the server. This can be achieved by targeting the response to a dummy frame.
Sample code:
<FRAMESET ROWS="100%,*">
<FRAME SRC="Form.html" NAME="FormFrame">
<FRAME SRC=about:blank NAME="DummyFrame" NORESIZE>
</FRAMESET>
Thus, result will be put into non-vizible frame without affecting the form display.
Can I send form data to an email address by clicking on Submit button?
One can send form data to email address by setting the ACTION attribute to 'mailto:emailid'.
Sample code:
<FORM METHOD="POST" ACTION="mailto:reader@company.com" >
Is it possible to send the form data to the plug-in?
Yes, It is possible to send the form data to the local plug-in. Assign the filename invoking the
plug-in to the form's ACTION with get method.
i.e., <FORM METHOD="GET" ACTION="filename.xyz" >
// to invoke the plug-in supporting *.xyz files
This will send the form data along with the URL. The data will be at NPStream parameter of
NPP_NewStream function.
Can I change font for the Input text element?
With Navigator 3.0 or below it is not possible to use font tag with Input, Select elements. With
Communicator it is possible to change the fonts of these elements using Font tag.
How can I upload a file to server?
You can upload a file using <INPUT TYPE='file'> within a FORM tag. This will allow you to
select files through browse button.
To upload more than one file it needs to define multiple <INPUT TYPE='file'> tags as it is not
possible to choose multiple files through a single INPUT tag.
Can I change the target frame depending on the form input?
Yes, It is possible to change the target frame using javascript target property. Use onSubmit event
handler to define the target's
How can I give a WAIT message to user while he submits the form and waiting for the response?
If the document URL is changed immediately after submission of the form, then the link to the
URL specified by action attribute will stop. Thus directly it is not possible to show the wait
message file in the same frame or window. Two possible solutions to this are:
1. Display the message in some other frame
2. Copy the form data into a similar form in an hidden frame and send it targeting the response to
original frame and meanwhile display the WAIT message.
Can I use 'Accept' attribute with the form input type File?
ACCEPT attribute is a feature of Input tag of file type. This allows to list all media types or type
patterns for the input. ACCEPT attribute can't be used, as is not implemented. Future versions may
support it.
For more information on this, please refer to RFC 1867.
FRAMES
• Is it possible to control backward and forward movements in each frame?
• When tried to read the URL of a frame some times it gives [objet Location] instead of actual
location. Why?
IMAGES
• Can I display the image only if date is valid?
• What happens if I assign fractional values to the height and width attributes?
Can I display the image only if date is valid?
This is a way of controlling the image display depending on the date. The following JavaScript
code shows how to display the image only from mm1/dd1/yy1 to mm2/dd2/yy2,
<SCRIPT>
function DisplayIfDateValid(url)
{
today = new Date()
<MAP name="FileMap">
<AREA COORDS='0,0,100,100' HREF='file:///c:/File1.html'>
<AREA COORDS='100,0,200,100' HREF='file:///c:/File2.html' >
</MAP>
function OpenLocs(location1,location2)
{
parent.frame1.location.href = location1;
parent.frame2.location.href = location2;
}
How to grab the coordinates of a spot clicked on an image map?
Specify the image as a standard image map with ISMAP attribute and with this whenever you
click on the image, Navigator requests URL of the form
URL?x,y
Here x and y are the horizontal and vertical coordinates of the mouse pointer when clicked. These
coordinates are in pixels from top-left of the image. Here is a code that grabs and displays the
coordinates.
LAYERS
• Can I make a selection to change the layer in another frame?
The following JavaScript function 'MoveTop' can be called from another frame (provided both
have same parent) to take the overlapped layer 'topLayr' to the top of 'prvLayr'.
<SCRIPT>
function MoveTop()
{
parent.LayerFrame.document.topLayr.moveAbove(parent.LayerFrame.document.prvLayr);
}
</SCRIPT>
Why the layer having applets, plug-ins, forms always appears at the top?
There are special limitations on applets, plug-ins and form elements inside layers. As these
elements uses the native window.
Please refer here for more documentation:
Using Applets, Plug-ins and Forms in Layers
Can I have layer behind the body elements?
No, It is not possible to have a layer behind the body elements.
I am not able to create layers dynamically while loading the page, why?
It is possible to create a new Layer object by using the new operator only after the page has
completely finished loading. For more information on creating layers dynamically
3) Use a blank, transparent GIF, using WIDTH and HEIGHT to indicate the desired
whitespace. This is a very ugly solution, as it only works if you have image loading on,
otherwise you get the "Image" icon at the beginning of the line. Not all browsers support
resizing using these attributes, and you can only "indent" a certain number of pixels, not
characters. So the amount of "indentation" varies with the font size used to display your
document.
Second, keep in mind that many people consider this even worse than <BLINK>, and
that it also suppresses the status information which normally appears there. It prevents
people from knowing where a link goes to.
How do I do a pagebreak?
You don't. HTML is not a page layout language. It's up to the browser to decide where
and how to insert page breaks when the document is being printed.
However, style sheets (not widely supported yet, although Microsoft's Internet Explorer
is beginning to use it) will include support to indicate preferred points for page breaks,
probably somewhat like the way LaTeX handles this.
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.
1.4. How can I show HTML examples without them being interpreted as
part of my document?
Within the HTML example, first replace the "&" character with "&" everywhere it
occurs. Then replace the "<" character with "<" and the ">" character with ">" in
the same way.
The next Q&A addresses the more general issue of representing arbitrary characters in
HTML documents.
[Table of Contents]
On platforms whose own character code isn't ISO-8859-1, such as MS DOS, Macs, there
may be problems: you'd have to use text transfer methods that convert between the
platform's own code and ISO-8859-1 (e.g Fetch for the Mac), or convert separately (e.g
GNU recode). Using 7-bit ASCII with entities avoids those problems, and this FAQ is too
small to cover other possibilities in detail. Mac users - see the notes at the above URL.
If you run a web server (httpd) on a platform whose own character code isn't ISO-8859-1,
such as a Mac, or IBM mainframe, it's the job of the server to convert text documents into
ISO-8859-1 code when sending them to the network.
If you want to use characters outside of the ISO-8859-1 repertoire, you must use HTML 4
rather than HTML 3.2. See the HTML 4.01 Recommendation at
<URL:http://www.w3.org/TR/html4/> and the Babel site at
<URL:http://babel.alis.com:8080/> for more details. Another useful resource for
internationalization issues is at <URL:http://ppewww.ph.gla.ac.uk/%7Eflavell/charset/>.
[Table of Contents]
Both these methods are correct according to the spec and are supported by current
browsers, but both were poorly supported in some earlier browsers. The only truly safe
advice is to rewrite the text so that the attribute value need not contain quotes, or to
• <!---->
• <!>
But some browsers do not support the full syntax, so we recommend you follow this
simple rule to compose valid and accepted comments:
An HTML comment begins with "<!--", ends with "-->" and does not contain "--" or ">"
anywhere in the comment.
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.htmlhelp.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.
While checking for errors in the HTML, it is also a good idea to check for hypertext links
which are no longer valid. There are several link checkers available for various platforms
which will follow all links on a site and return a list of the ones which are non-
functioning.
You can find a list of validators, linters, and link checkers at
<URL:http://www.htmlhelp.com/links/validators.htm>. Especially recommended is the
use of an SGML-based validator such as the WDG HTML Validator
<URL:http://www.htmlhelp.com/tools/validator/> or W3C HTML Validation Service
<URL:http://validator.w3.org/>.
[Table of Contents]
• Most earch engines ignore image maps, forms, and JavaScript, so make sure that
navigating your site doesn't depend on them. Provide normal links for site navigation.
• Avoid using META refresh, because many search engines penalize sites that use
it (META refresh has been used to trick search engines).
• The indexing programs of some search engines (including AltaVista and
Infoseek) will also take into account <META NAME="keywords" CONTENT="..."> tags that
appear in the <HEAD> part of your documents. However, META keywords have been
used to trick search engines, so many will ignore your keywords list if you repeat a given
keyword too often. At this writing, "too often" means "more than 7 times" to some
popular engines, but that may change in the future as indexing programs are changed to
defend against trickery.
• If you include a <META NAME="description" CONTENT="..."> tag in the <HEAD> part
of your documents, then some search engines will use the content of this tag as your site's
description when displaying search results. This won't affect your ranking in searches,
but it can help search engine users understand what your site offers when a search does
find your site.
The CONTENT attribute of the META keywords and description tags may contain up to
1022 characters, but no markup other than entities.
You might want to preview your site with a text-only browser like Lynx, to get an idea of
how your site appears to search engines. Search Engine Watch at
<URL:http://searchenginewatch.com/> is a Web site dedicated to search engines and
strategies for Web page authors.
Finally, note that some search engines ignore sites hosted by well-known free hosting
services. Other search engines index only a certain number of documents per server, so
while early customers of free hosting services may be indexed, later customers may be
ignored.
[Table of Contents]
The Expires header is understood by virtually all caches. The cached document will be
retrieved again automatically once it has expired. The Expires header must contain an
HTTP date, which must be Greenwich Mean Time (GMT), not local time.
HTTP 1.1 introduced the Cache-Control header, which provides more flexibility for telling
caches how to handle the document. For more information, see the HTTP 1.1 draft (see
<URL:http://www.w3.org/Protocols/>).
The configuration details vary from server to server, so check your server documentation.
For example, if your server is Apache, see
<URL:http://www.apache.org/docs/mod/mod_expires.html> for information about
setting the Expires header, and
<URL:http://www.apache.org/docs/mod/mod_headers.html> for information about
setting other headers.
The Pragma header is generally ineffective because its meaning is not standardized and
few caches honor it. Using <META HTTP-EQUIV=...> elements in HTML documents is also
generally ineffective; some browsers may honor such markup, but other caches ignore it
completely.
Further discussion can be found at <URL:http://www.mnot.net/cache_docs/>.
[Table of Contents]
Keep in mind not all browsers identify themselves correctly. Microsoft Internet Explorer,
for example, claims to be "Mozilla" to get at Netscape enhanced documents.
And of course, if a cache proxy keeps the Netscape enhanced document, someone with
another browser will also get this document if he goes through the cache.
For these reasons and others, it is not a good idea to play the browser guessing game.
[Table of Contents]
True dynamic inclusion of one HTML document (even in a different "charset") into
another is offered by the OBJECT element, but due to shortcomings of browser
versions in current use, it seems unwise to rely on this yet for essential content. The
same can be said for IFRAME.
Two popular ways of including the contents of one file seamlessly into another for the
WWW are preprocessing and server-side inclusion.
Preprocessing techniques include the C preprocessor and other generic text
manipulation methods, and several HTML-specific processors. There is a nice
annotated list of HTML preprocessors at
<http://www.idocs.com/wmr/software/html+preprocessors/>.
Beware of making your "source code" non-portable. Also, the HTML can only be
validated after pre-processing, so the typical cycle "Edit, Check, Upload" becomes
"Edit, Preprocess, Check, Upload" (here, "Check" includes whatever steps you use to
preview your pages: validation, linting, management walk-through etc.; and "upload"
means whatever you do to finally publish your new pages to the web server).
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's online HTML Validator at
<URL:http://www.htmlhelp.com/tools/validator/> which supports HTML 4 and
understands different character encodings.
"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.
• http://www.czyborra.com/
• http://mirror.subotnik.net/jkorpela/chars.html
• http://ppewww.ph.gla.ac.uk/~flavell/charset/
[Table of Contents]
Note that XHTML 1.0 (a reformulation of HTML 4.01 as an XML 1.0 application)
requires element and attribute names to be in lower case.
[Table of Contents]
Images cannot be wrapped, so you have to be careful with them. It seems that 400 or
500 pixels is a reasonable width; anything above 600 will mean a certain percentage of
users will have to scroll to see the rightmost bit. This percentage increases with your
image width. Keep in mind that not everyone runs his browser at full screen!
(WebTV users have no ability to scroll horizontally, so anything beyond 544 pixels will
be compressed by their browser. Some other devices may be even more limited.)
The use of tables for layout, especially when fixed-width cells are used, is the most
usual single factor that prevents pages from adapting to various window widths. This is
explained in detail at <URL:http://www.dantobias.com/webtips/tables.html>.
[Table of Contents]
3.5. Why does my page display fine in browser X but incorrectly or not at
all in browser Y?
There are several possibilities.
First, you may have some incorrect HTML. Browsers vary in their ability to guess what
you meant. For instance, Netscape is much more fussy about tables than MS Internet
Explorer, so a page with incorrect tables may look fine in MSIE but not display at all in
Netscape. See the answer to "How can I check for errors?" for tips on finding your
HTML errors. (In fact, even correct nested tables may not display correctly in
Netscape. See the answer to "Can I nest tables within tables?" for what you can do
about that.)
Second, you may have valid HTML that different browsers interpret differently. For
instance, it is not clear from the spec what should be done with a string of
characters. Some browsers will collapse them for rendering as a single space; others
will render one space per .
Third, your server may be sending incorrect MIME types for some of your files.
Internet Explorer incorrectly ignores server-provided MIME types, so it sometimes
"does the right thing" when the server is misconfigured. Other browsers correctly heed
the server-provided MIME types, so they will reveal server misconfigurations.
Other possibilities are a bug in one or the other browser, or different user option
settings.
Second, link to the named anchor. The URL of the named anchor is the URL of the
document, with "#" and the name of the anchor appended. For example, elsewhere in the
same document you could use:
<A HREF="#section2">go to Section 2</A>
[Table of Contents]
<A TARGET="foobar" HREF=...> opens a new window named "foobar", provided that a
window or frame by that name does not already exist.
Note that links that open new windows can be annoying to your readers if there is not a
good reason (from the reader's perspective) for them.
[Table of Contents]
4.4. How do I create a link that opens a new window of a specific size?
Start with a normal HTML link (possibly one that opens in a new window as described in
the answer to the previous question). Then use the ONCLICK attribute to open a window
with the desired appearance for those readers with JavaScript supported and enabled. The
following example specifies a window named "popup" that is 300 pixels by 150 pixels.
<A HREF="foo.html" TARGET="popup" ONCLICK="window.open('foo.html', 'popup',
'width=300,height=150'); return false">View Foo</A>
Used in this manner, JavaScript can specify a new window with the desired appearance,
without blocking access when JavaScript is unsupported/disabled.
In addition to the parameters height and width (which take a pixel count as a value), the
third argument to the window.open() can include the following booloean parameters (which
take "yes" or "no" as a value): directories, location, menubar, resizable, scrollbars, status,
and toolbar. These boolean parameters control the presence of the corresponding window
decorations in the resulting window.
[Table of Contents]
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.
A go-to-other-page button can also be coded in JavaScript, but the above is standard
HTML and works for more readers.
[Table of Contents]
Also, it is worth noting that the only navigation tool used more frequently than the "back"
function is the hyperlink. Your readers almost certainly know how to use their browsers'
"back" function. Users who don't know how to use basic functions of their browsers will
only be confused when various pages imitate those functions in different ways.
[Table of Contents]
Note that any email address that you publish on the WWW like this will probably start
receiving unsolicited commercial email (UCE, junk email). It's a good idea to protect
your real email address (e.g., by filtering incoming email, or by using a separate address
only for mailto links).
[Table of Contents]
[Table of Contents]
[Table of Contents]
[Table of Contents]
[Table of Contents]
4.16. How can I make links change when the cursor is over them?
In your style sheet, use the hover pseudo-class to specify a different appearance for links
when the cursor is over them. Specify the hover pseudo-class after the link and visited
pseudo-classes. For example:
A:link { color: blue ; background: white }
A:visited { color: purple ; background: white }
A:hover { color: red ; background: white }
[Table of Contents]
4.17. Why are my hyperlinks coming out all wrong or not loading?
Most likely you forgot to close a quote at the end of the HREF attribute. Alternatively,
perhaps you used a ">" character somewhere else inside a tag. Although this is legal,
several older browsers will think the tag ends there, so the rest is displayed as normal
text.
This especially happens if you use comment tags to "comment out" text with HTML tags.
(See the answer to "How can I include comments in HTML?") Although the correct
syntax is <!-- --> (without "--" occurring anywhere inside the comment), some browsers
will think the comment ends at the first ">" they see.
Validators will show you any syntax errors in your markup, but checkers such as Weblint
and HTMLchek can show you where you are liable to provoke known browser bugs. For
example, some versions of Netscape Navigator are known to have problems with links to
named anchors when the anchors are within a table that uses the ALIGN attribute. See
also the answer to "How can I check for errors?"
Another possibility is that your web authoring software used file URLs (e.g.,
file:C:\path\file.html). If so, then you should replace them with relative URLs (e.g., file.html)
or http URLs (e.g., http://server/path/file.html).
4.18. Why does my link work in Internet Explorer but not in Netscape?
Is there a space, #, ?, or other special character in the path or filename? Spaces are not
legal in URLs. If you encode the space by replacing it with %20, your link will work.
You can encode any character in a URL as % plus the two-digit hex value of the
character. (Hex digits A-F can be in upper or lower case.) According to the spec, only
alphanumerics and the special characters -_.!*'() never need to be encoded.
You should encode all other characters when they occur in a URL, except when they're
used for their reserved purposes. For example, if you wanted to pass the value
"Jack&Jill" to a CGI script, you would need to encode the "&" character as "%26", which
might give you a URL like the following:
http://www.foo.com/foo.cgi?rhyme=Jack%26Jill&audience=child
Note that the "?" and other "&" character in this URL are not encoded since they're used
for their reserved purposes. However, when this URL is used as an attribute value in an
HTML document, the "&" character must be encoded as "&", like the following: <A
HREF="http://www.foo.com/foo.cgi?rhyme=Jack%26Jill&audience=child">
It is possible that the server might need to be configured for some different file types.
(See the next Q&A.)
[Table of Contents]
5.2. Why did my link to a ... file download a bunch of characters instead?
If you are trying to link to a particular type of file and it is not returning your desired
response, chances are that the server needs to have the type configured. Talk to your
system administrator about getting them to add the content type. Here is a list of common
types that often need configuring:
Content Type Description
Application/msword Microsoft Word Document
Unclassified binary data (often used for compressed file or
application/octet-stream
executable)
application/pdf PDF Document
application/wordperfect6.0 WordPerfect 6.0 Document
application/zip ZIP archive
audio/x-wav WAV audio format
audio/midi MIDI audio format
audio/x-pn-realaudio RealAudio
As explained in the answer to the previous question, the server is responsible for
identifying a document's media type properly, and the browser is responsible for deciding
how to handle the document (based on its media type). There is no way for a web author
to override the way the browser is configured to handle any given type of file.
• http://members.aol.com/royalef/gifanim.htm
• http://www.webreference.com/dev/gifanim/
[Table of Contents]
5.6. How can I create a thumbnail image that is linked to the full-sized
image?
A thumbnail image is just a copy of the full-sized image that has been modified to reduce
the size of the file. It is linked to the full-sized image with a normal link:
<A HREF="full-sized.jpg"><IMG SRC="thumbnail.jpg" ALT=...></A>
There are several techniques for reducing the size of the file for the thumbnail image,
including
• resampling/resizing the image to create a physically smaller image;
will have white space to the left and right of the image. Since many browsers display
anchors with colored underscores by default, they will show the spaces to the left and
right of the image with colored underscores.
Style checkers such as Weblint will call attention to this problem in your HTML source.
[Table of Contents]
5.9. Why are my images coming out all wrong or not loading?
Most likely you forgot to close a quote at the end of the SRC attribute. Alternatively,
perhaps you used a ">" character in an ALT text or somewhere else inside a tag.
Although this is legal, several older browsers will think the tag ends there, so the rest is
displayed as normal text.
This especially happens if you use comment tags to "comment out" text with HTML tags.
(See the answer to "How can I include comments in HTML?") Although the correct
syntax is <!-- --> (without "--" occurring anywhere inside the comment), some browsers
will think the comment ends at the first ">" they see.
Validators will show you any syntax errors in your markup, but checkers such as Weblint
and HTMLchek can show you where you are liable to provoke known browser bugs. See
also the answer to "How can I check for errors?"
Here are some other possibilities:
• Your web authoring software may have used file URLs (e.g., file:C:\path\image.gif).
If so, then you should replace them with relative URLs (e.g., image.gif) or http URLs (e.g.,
http://server/path/image.gif).
• Your images may be in a format that is not widely supported, like Microsoft's
BMP format or AOL's ART format. Be sure to save your images in a widely supported
There are tricks that make it more difficult for some readers to save your images.
However, just as with tricks that try to hide HTML source, these tricks cause various
problems for law-abiding users and can't really prevent thieves from saving your images.
[Table of Contents]
5.12. How do I get an audio file to play automatically when someone visits
my site?
Most browsers support the EMBED element for this, provided that the user has a suitable
plug-in for the sound file. You can reach a slightly wider audience if you use BGSOUND
as well. To avoid problems with browsers that support both, place the BGSOUND in a
NOEMBED container:
<EMBED SRC="your_sound_file" HIDDEN=true AUTOSTART=true>
<NOEMBED><BGSOUND SRC="your_sound_file"></NOEMBED>
Be aware that some users find it annoying for music to automatically start playing. They
may not have the volume set properly on their speakers, or they may be listening to
something else. As a courtesy to your users, you may prefer to offer the sound file as a
link:
[Table of Contents]
5.13. How can I strip all the HTML from a document to get plain text?
Many browsers have a "Save As..." function that allows you to specify plain text as the
output format. Another approach is to select all the text, copy it to the clipboard, and
paste it into an editor.
Lynx users can use "lynx -dump http://..." on the command line to print to file and
append a list of referenced URLs as footnotes. If you want the output file without the
footnotes, use the "p" command to "print" to a text file.
Some HTML authoring tools have an option to strip all HTML as well. Two programs of
note are
• HomeSite, available from <URL:http://www.allaire.com/>
• DiDa, available from <URL:http://www.faico.net/>
If you are looking for another method (in other words you want to make things more
difficult on yourself), you can obtain programs which will strip away all HTML markup
from a document. Try doing a search at <URL:http://www.altavista.com/> for the phrase
"HTML stripper".
For an experimental but somewhat more graceful approach, read about CSS1 and the
Decorative HR at <URL:http://ppewww.ph.gla.ac.uk/%7Eflavell/www/hrstyle.html>.
[Table of Contents]
• Create the bullet with the indent built in. For example, if you use a bullet that is
10 pixels across you can make the background 25 pixels (transparent) and put the bullet
all the way on the right. This will create a 15-pixel indent to the left of the bullet. It will
add slightly to the byte size of the graphic but since it is all one color it won't add much.
This method doesn't work well with any list items that are longer than a line (and
remember that you don't know how long a line will be on the visitor's screen).
[Table of Contents]
Perhaps what you really want is justified text, in which the left and right edges are both
aligned so that all lines are the same length. (This is sometimes incorrectly called "right
justify".) This presentation can be suggested in a CSS1 style sheet with text-align:justify, or
in HTML 4 with the deprecated attribute align="justify". (Before you do that, a caveat:
though justified text may look pretty, human factors analysis shows that ragged right is
actually easier to read and understand.)
For images, you can use <IMG ALIGN=right SRC="..." ALT="..."> before the running text. The
image will float at the right margin, and the running text will flow around it. Remember
to use <BR CLEAR=right> or <BR CLEAR=all> to mark the end of the text that is to be
affected in this way. For an explanation with nice examples, see
<URL:http://www.awpa.asn.au/html/images.html>.
[Table of Contents]
with this:
<TD ...><IMG SRC=... ALT=...><IMG SRC=... ALT=...></TD>
According to the latest specifications, the two should be equivalent. However, common
browsers do not comply with the specifications in this situation.
[Table of Contents]
/* Entire document */
BODY { margin-left: 20% }
With proprietary HTML extensions, you can set the margins for certain browsers.
Internet Explorer 3+ supports the TOPMARGIN and LEFTMARGIN attributes.
Internet Explorer 4+ added support for the BOTTOMMARGIN and RIGHTMARGIN
attributes. Navigator 4+ supports the MARGINWIDTH and MARGINHEIGHT
attributes. Most other browsers ignore these proprietary extensions.
In general, page breaks are not appropriate on the Web since what makes a nice page
break for you with your font and font size may be a poor page break for me with my font
and font size.
If you need to produce a nicely formatted printed copy of your HTML documents, you
might also consider using special purpose tools rather than your browser's Print function.
For example, html2ps generates nicely formatted PostScript output from HTML
documents, and HTML Scissor uses special HTML comments for suggesting page
breaks.
[Table of Contents]
For practical advise on using fonts on the web, see Todd Fahrner's "Beyond the FONT
tag: Practical HTML text styling" at: <http://style.metrius.com/font_size/livetext.html>
[Table of Contents]
With HTML, you can suggest colors with the TEXT, LINK, VLINK (visited link),
ALINK (active link), and BGCOLOR (background color) attributes of the BODY
element. If one of these attributes is used, then all of them should be used to ensure that
the reader's default colors do not interfere with those suggested by the author. Here is an
example:
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#000080">
When displayed according to this CSS ruleset, the emphasized text in the following
HTML example will be displayed in green:
normal text <EM CLASS="special">emphasized text</EM> normal text
Note that the fixed property used in the above style sheet is supported by Internet Explorer
3+, Netscape Navigator 5+, and other browsers. In contrast, the proprietary
BGPROPERTIES=fixed attribute is supported only by Internet Explorer 3+.
[Table of Contents]
[Table of Contents]
6.18. How can I have a custom icon when people bookmark my site?
This is a feature introduced by Internet Explorer 5.x. By default, the browser requests a
file named "favicon.ico" at the same base URL as the document being bookmarked. If it
doesn't find this file, then it will try again in the root directory of your site. Web authors
can specify a different path for the icon file with a <LINK> element like this: <LINK
REL="SHORTCUT ICON" HREF="/pathname/filename.ico">
The image should be 16 by 16 pixels, in the Windows icon format. If your graphics
program doesn't support the Windows icon format, you can use a tool like the free Java-
based icon generator at <URL:http://www.favicon.com/> to convert/create your icon.
[Table of Contents]
7.7. Why doesn't <TABLE WIDTH="100%"> use the full browser width?
Graphical browsers leave a narrow margin between the edge of the display area and the
content. For information on how you can specify that the browser omit these margins, see
the answer to the question "How do I eliminate the margins around my page?"
Also note that Navigator always leaves room for a scrollbar on the right, but draws the
scrollbar only when the document is long enough to require scrolling. If the document
does not require scrolling, then this leaves a right "margin" that cannot be removed.
[Table of Contents]
7.9. Are there any problems with using tables for layout?
On current browsers, the entire table must be downloaded and the dimensions of
everything in the table must to be known before the table can be rendered. That can delay
the rendering of your content, especially if your table contains images without HEIGHT
or WIDTH attributes.
If any of your table's content is too wide for the available display area, then the table
stretches to accomodate the oversized content. The rest of the content then adjusts to fit
the oversized table rather than fitting the available display area. This can force your
readers to scroll horizontally to read your content, or can cause printed versions to be
cropped.
For readers whose displays are narrower than the author anticipated, fixed-width tables
cause the same problems as other oversized tables. For readers whose displays are wider
than the author anticipated, fixed-width tables cause extremely wide pargins, wasting
much of the display area. For readers who need larger fonts, fixed-width tables can cause
the content to be displayed in short choppy lines of only a few words each.
Many browsers are especially sensitive to invalid syntax when tables are involved.
Correct syntax is especially critical. See the answer to "How can I check for errors?"
Even with correct syntax, nested tables may not display correctly in Netscape. See the
answer to "Can I nest tables within tables?" for what you can do about that.
Some browsers ignore tables, or can be configured to ignore tables. These browsers will
ignore any layout you've created with tables. Also, search engines ignore tables. Some
search engines use the text at the beginning of a document to summarize it when it
appears in search results, and some index only the first n bytes of a document. When
tables are used for layout, the beginning of a document often contains many navigation
links that appear before than actual content.
Many versions of Navigator have problems linking to named anchors when they are
inside a table that uses the ALIGN attribute. These browsers seem to associate the named
anchor with the top of the table, rather than with the content of the anchor. You can avoid
this problem by not using the ALIGN attribute on your tables.
<script type="text/javascript"><!--
document.myform.myinput.focus();
//--></script>
A similar approach uses <BODY ONLOAD=...> to set the focus, but some browsers seem to
process the ONLOAD event before the entire document (i.e., the part with the form) has
been loaded.
[Table of Contents]
8.7. Can I have two or more Submit buttons in the same form?
Sure. This is part of HTML 2.0 Forms support (some early browsers did not support it,
but browser coverage is now excellent).
You will need to give your Submit buttons a Name attribute, and, optionally, a Value
attribute. In order to determine which button was used, you will want to use distinctive
Names, or Values, or both. Browsers will display the Value, in addition to sending it to
the server, so choose something that's meaningful to the user as in the following example:
<INPUT TYPE=SUBMIT NAME=join VALUE="I want to join now"> -or-
<INPUT TYPE=SUBMIT NAME=info VALUE="Please send full details">
Note that if you are using image submit buttons, you need to provide different Value
attributes for them too.
If you're unsure what results you're going to get when you submit your form, TipJar has a
standard script which you can use. Code this, for example (assuming method "post"):
<form method="post" action="http://www.tipjar.com/cgi-bin/test">
and then go through the motions of submitting your form. The TipJar server decodes the
form input, and displays the result to you.
Not all browsers support form-based file upload, so try to give alternatives where
possible. Also, if you need to do file upload in conjunction with form-to-email, the Perl
package MIME::Lite handles email attachments.
[Table of Contents]
9.2. How do I make a link or form in one frame update another frame?
In the frameset document (the HTML document containing the <FRAMESET> and
<FRAME> elements), make sure to name the individual frames using the NAME attribute.
The following example creates a top frame named "navigation" and a bottom frame
named "content":
<FRAMESET ROWS="*,3*">
<FRAME NAME="navigation" SRC="navigation.html">
<FRAME NAME="content" SRC="content.html">
<NOFRAMES><BODY>
<!-- Alternative non-framed version -->
</BODY></NOFRAMES>
</FRAMESET>
Then, in the document with the link, use the TARGET attribute to specify which frame
should be used to display the link. (The value of the TARGET attribute should match the
value of the target frame's NAME attribute.) You can specify the target frame for a link
(e.g., <A TARGET="content" HREF=...>) or for a form (e.g., <FORM TARGET="content"
ACTION=...>). Also, you can use <BASE TARGET=...> to change the default target frame for
the entire document (normally, the default target frame is "_self", the current frame).
[Table of Contents]
In HTML 4, the TARGET attribute value is case-insensitive, so that abc and ABC both refer
to the same frame/window, and _top and _TOP both have the same meaning. However,
most browsers treat the TARGET attribute value as case-sensitive and do not recognize
ABC as being the same as abc, or _TOP as having the special meaning of _top.
Also, some browsers include a security feature that prevents documents from being
hijacked by third-party framesets. In these browsers, if a document's link targets a frame
defined by a frameset document that is located on a different server than the document
itself, then the link opens in a new window instead.
[Table of Contents]
The HTML-based technique can link to a new frameset document with TARGET="_top"
(replacing the entire frameset), but there is an alternative if the frames to be updated are
part of a nested frameset. In the initial frameset document, use a secondary frameset
document to define the nested frameset. For example:
<FRAMESET COLS="*,3*">
<FRAME SRC="contents.html" NAME="Contents">
<FRAME SRC="frameset2.html" NAME="Display">
</FRAMESET>
A link can now use TARGET="Display" to replace simultaneously all the frames defined by
frameset2.html.
The JavaScript-based solution uses the onClick attribute of the link to perform the
secondary update. For example:
<A HREF="URL1" TARGET=Frame1
onClick="top.Frame2.location='URL2';">Update frames</A>
The link will update Frame1 with URL1 normally. If the reader's browser supports
JavaScript (and has it enabled), then Frame2 will also be updated (with URL2).
[Table of Contents]
9.6. How do I make sure my framed documents are displayed inside their
frameset?
When the sub-documents of a frameset state are accessed directly, they appear without
the context of the surrounding frameset.
If the reader's browser has JavaScript support enabled, the following script will restore
the frameset:
<SCRIPT TYPE="text/javascript">
<!--
if (parent.location.href == self.location.href) {
if (window.location.replace)
window.location.replace('frameset.html');
else
// causes problems with back button, but works
window.location.href = 'frameset.html';
}
// -->
</SCRIPT>
A more universal approach is a "restore frames" link:
<A HREF="frameset.html" TARGET="_top">Restore Frames</A>
Note that in either case, you must have a separate frameset document for every content
document. If you link to the default frameset document, then your reader will get the
default content document, rather than the content document he/she was trying to access.
These frameset documents should be generated automatically, to avoid the tedium and
inaccuracy of creating them by hand.
Note that you can work around the problem with bookmarking frameset states by linking
to these separate frameset documents using TARGET="_top", rather than linking to the
individual content documents.
[Table of Contents]
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. If you can
configure your server to send the proprietary header Window-Target: _top in the HTTP
response, then Netscape browsers will display your document in the full browser
window. However, other browsers ignore this header, and it doesn't work to use <META
HTTP-EQUIV="Window-target" CONTENT="_top"> in the document itself to mimic the HTTP
response.
Another 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.
If the reader's browser has JavaScript enabled, the following script will automatically
remove any existing framesets:
<SCRIPT TYPE="text/javascript">
<!--
if (top.frames.length!=0)
top.location=self.document.location;
// -->
</SCRIPT>
An alternative script is
<SCRIPT TYPE="text/javascript">
<!--
function breakOut() {
if (self != top)
window.open("my URL","_top","");
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="breakOut()">
[Table of Contents]
Note that these attributes are proprietary and not part of the HTML 4 specifications. Also,
removing the border around a frame makes it impossible to resize it, as this border is also
used in most GUIs to change the size of the window.
[Table of Contents]
Search engines will index your <NOFRAMES> content, and any content that is accessible
via your <NOFRAMES> content. Such content should be useful when accessed directly
from a search-engine link.
As stated in http://www.w3.org/Addressing/rfc1738.txt:
A mailto URL takes the form:
mailto:<rfc822-addr-spec>
o http://www.cgi-
resources.com/Programs_and_Scripts/Remotely_Hosted/Form_Processing
/
Then in the file mainarea.html you will have another frameset that defines 'banner'
and 'main'.
When you want to update both frames at the same time you will target mainarea
and load another frameset identical to the one in mainarea.html but that contains
information on the new desired frames.
While you can use JavaScript to update two frames, this method will not work on
non JavaScript enabled browsers. Using JavaScript is much easier to set up, but
you will be sacrificing functionality for simplicity. If you do still wish to use
JavaScript you can find a script at the following page.
o http://www.sbrady.com/hotsource/javascript/twoframes.html
There is no 'standard' way supported fully by browsers to make sound play in the
background of a webpage. However, you can use proprietary tags from Navigator
and Explorer.
<embed src="bgsound.wav" autostart="TRUE" hidden="TRUE" loop="TRUE">
<noembed>
<bgsound src="bgsound.wav" loop="-1">
</noembed>
Change oldvirtualURL to the path of the old URL and newURL to the path of the
new url. An example of a redirection would be:
Redirect /path/to/file.html http://www.domain.com/newpath/to/file.html
o http://hoohoo.ncsa.uiuc.edu/docs/howto/Redirect.html
The "meta refresh" tag is a Netscape incarnate and doesn't work in all browsers. If
you use this solution you should always include a link within the document to the
new page. Meta tags are placed within the <head> tags and after the the <title> tag.
Replace [S] with the number of seconds to wait before refreshing, and
[http://www.domain.com/page.html] with the URL of the page you wish to "refresh" to.
o http://www.worldwidemart.com/scripts/
o http://www.scriptsearch.com/
o http://www.markwelch.com/bannerad/baf_counter.htm
16. How do I remove the little blue spec from the bottom right side of my
image?
This happens when you make an image a link and there is a space between the
end of the image tag and the ending [</a>] tag. Nothing has physically happening
to the image; what is really happening is the extra space is being turned into a link
and is therefor underlined.
Fixed markup:
<a href="path/to/file.html"><img src="image.gif" alt="example"></a>
If, when you use the above method to invoke a download, strange characters start
appearing, your server is not configured properly. Contact the server administrator
and ask him or her to configure the proper content type.
23. What is the Websafe pallet and where can I find it?
The Websafe Pallet consists of 216 colors that can be displayed correctly, without
dithering (bleeding), on cross-platform, cross-browser, 256 color systems.
Websafe Colors consist of the following doubles: 00, 33, 66, 99, CC, and FF. The
following page has a complete listing of the Websafe Pallet.
o http://www.sbrady.com/hotsource/html/websafe.html
Fixed markup:
<table border=0 cellspacing=0 cellpadding=0><tr>
<td><img src="foobar.gif" width=20 height=20 alt="alternate text"></td>
</tr></table>
Cost
Starting up your own web-related business can be done with a small initial
investment. Many people already have computers, internet connections, software,
peripherals, among other things needed to run a business. Your own domain name
will be essential (no Geocities pages) for any serious business venture and won't
run you much money ($35 USD per year plus $360 USD per year for hosting).
Even with that in mind, costs can climb steeply depending on how far you want to
take your business.
A big question you should ask yourself is whether you want to offer webhosting
and other related services to your clients (here is where the cost starts to go up).
Fortunately, the many costs involved with webhost (bandwidth, machines, UPS,
secure complex) can be averted by providing your hosting through a reseller
program. Many ISPs offer reseller programs that can quickly turn a profit. For
example, you might buy 1MB of space for $0.50 and resell it for $1.50 when
bundled with other services such as email accounts, ftp access, and advanced
server-software.
o Register a Domain Name
http://www.icann.org/registrars/accredited-list.html
o Lucrative Reseller Program
http://www.iserver.com/
What should I charge?
It is against the law in many countries for competing businesses to share pricing
information with each other. With that said, please don't ask me or anyone else in
this group or any other group what we charge. But take heart, there have been
many surveys on billing practices and billing rates.
1. What is HTML?
HyperText Markup Language:
HTML is a plain text file with commands <markup tags> to tell the Web browsers how to
display the file.
Tim Berners-Lee created HTML while at CERN, (the European Laboratory for Particle
Physics) in Geneva.
2. How do I start?
Here's a basic HTML document layout:
<HTML>
<HEAD>
<TITLE>Snowi's Stuff</TITLE>
</HEAD>
(Note: The words between the TITLE tags, in this case, "Snowi's Stuff" will show up on
the header line of browsers viewing the page; and also, it will be the default title when the
page is added to a browser's favorites or bookmarks.)
<H1>Snowi's Stuff</H1>
(Note: The following is how to make the word "Snowhawk's" a link to the Web page
http://www.snowhawk.com/)
<A HREF="http://www.snowhawk.com/">Snowhawk's</A>
</BODY>
</HTML>
That's the basic beginnings of writing an HTML file. You save it in notepad, word,
whatever text editor, as yourfile.html (or .htm if your system doesn't allow 4 characters
for the file type). Then you FTP the file to your server. [Your ISP (Internet Service
Provider) will give you their FTP address of where to upload your files. If your service
doesn't offer Web site space, there are several that offer free Web space.]
To change the color of a word, or sentence, you put <FONT COLOR="#cc0000"> before
the text you want colored, and </FONT> at the end. (substituting the "cc0000" with the
code for the color you want)
In the color code "#CC0000" - the "CC" position is red, center "00" position is green, and
last "00" position is blue.
Web Safe Colors use lower numbers for darkest colors, going 00, 33, 66, and 99, then cc,
and ff... with 'ff' being the lightest.
4. How do I use a picture as the background?
Include the element "background" with the name of the graphics file:
<BODY BACKGROUND="gumby.gif" BGCOLOR="#ffffff" TEXT="#000000"
LINK="#cc0000" VLINK="#000066" ALINK="#ffff00">
(Note: the "bgcolor" element remained along with the added "background" element. This
way, the browser will display the color you designate while the background graphic is
loading. Not required, but using a color similar to the background file will ensure viewers
can see your page well enough to begin reading while the background graphic is loading.)
The Heading tags will default align to the left. If you want to center the heading, you
would use:
<H3 align=center>Heading here</H3>
...to have the heading aligned to the right, you would use:
<H3 align=right>Heading here</H3>
To adjust the size of any text, use the <FONT SIZE="-1">to go smaller one size, ending with
closing tag</FONT> And <FONT SIZE="+1">for text one size larger.</FONT>
To center any text, or image, you begin the line with the center tag:
<CENTER><FONT SIZE="-1" COLOR="#009900">text</FONT></CENTER>
Always close the last tag first... such as "font" was closed before "center" above;
otherwise the browsers have a "field day" with your text.
<body>
<h1>New Products from Zippy Communications<h1>
......
......
</body>
</html>
The same text is used twice -- once for the web browser to identify the
page and once in the <h1> tag to put the same title on the page.
Could you please help with a tag that makes all HTML
commands inside the tag text/ignored?
Bad news first...
There is no such tag. Even if you use <pre>...</pre> tags, your browser will
interpret any HTML as... HTML.
"How can I force the text not to wrap at the edge of the
browser window?"
There are some page designs where you may not want the text content to
wrap-- notably a large table of data perhaps in a <pre>...</pre> or perhaps a
timeline where you would like the user to use the scroll bar to navigate
through content laid out in horizontal layout.
There is a subtle variation of the line break tag, namely the No Break tag
<nobr>...</nobr> which tells the browser to not wrap whatever is inside,
which could be text, pictures, or any content. The usage would be
something like:
<nobr>
<h1>Come Scroll with me, away to the right, as I list
out all of the long answers to the
meaning of life accessible only to those that can scroll,
scroll, scroll...</h1>
</nobr>
Another example is a framed page where the lower frame contains a
horizontal scrolling list of links to images.
Just place the following code inside the <HEAD>...</HEAD> of your HTML
file:
<style type="text/css">
<1--
A:link, A:visited, A:active { text-decoration: none }
-->
Tables
How can I create a blank cell in a table that displays its borders?
Put a non-breaking space character in the cell using " ".
How can I space out a table cell with blank lines?
Users often ask how they can space out items vertically in a tabled list. Adding a <P> tag at the end of each
cell doesn't work because Internet Explorer ignores tags that don't contain any content. Instead, use <P>
and <BR> tags (or two <P> tags, depending on how much space you need) and add a non-breaking space in
between:
<p> <br>
Frames
Why does my page display as blank with some browsers?
Pages that use frames must also include content for browsers that do not support frames. You include the
alternate content in the <NOFRAMES> section of your frameset document. If you don't provide this
content, your page will appear blank in Internet Explorer 2.0 or other browsers that don't support frames.
See the next question for more information on coding for non-frame browsers.
How do I code frames to be compatible with non-frame browsers?
The document containing your frameset commands must also contain a <NOFRAMES> section that
contains the HTML material you want the other browsers to display, for example:
<HTML>
<HEAD>
</HEAD>
<FRAMESET COLS="80,100%" FRAMEBORDER="no" FRAMESPACING=0>
<FRAME SRC= NAME= >
<FRAME SRC= NAME= >
<NOFRAMES>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#000000">
Content to be displayed by other browsers...
</BODY>
</NOFRAMES>
</FRAMESET>
</HTML>
Browsers that don't support frames will ignore the <FRAMESET>, <FRAME>, and <NOFRAMES> tags
and will display the contents of the <BODY> section.
Note: The <FRAME> tags should not appear between <BODY> and </BODY> tags.
How do I create a link that changes the content of a different frame?
Include TARGET="framename" in the link, for example:
<A HREF="http://www.my.com/my.htm" TARGET="frame1">
Note that target names are case sensitive. You can also use any of the following predefined target names:
Target Description
name
_blank Load this link into a new, unnamed window.
_self Load this link within the current frame.
</BODY>
</HTML>
Style Sheets
How are measurements handled?
In general, you should specify font sizes and line-height using point size rather than pixels. A font that is
16-pixels tall may look fine on the screen, but it looks small on a 300-dpi printer. For indents and other
measurements, you might consider using inches.
What's the difference between the <DIV> and <SPAN> tags?
Think of <DIV> as a container version of <BR>. The <BR> tag allows you to add a simple line break into
your document. The <DIV> tag, being a container, also allows you to specify additional attributes, such as
CLASS for assigning a CSS class to this section.
If all you want to do is provide simple highlighting of a word or short phrase in a longer sentence without
line breaks, use <SPAN>. This is a "do nothing" container tag that implies no default formatting of its own.
However, it is a container, so you can assign a CLASS (or STYLE) attribute to it to achieve your goal.
Thus, to highlight a word in a sentence use the following code:
This is your last <span style="background:yellow; color:red;
• Impact: ftp://ftp.microsoft.com/developr/drg/truetype/impact.exe
Forms
How can I control the use of the ENTER key to submit a form?
If you have a single form on your page, pressing the ENTER key submits the form, even if you don't have
an <INPUT TYPE=SUBMIT> button. This can bypass your validation script. The easiest way to prevent
this action is to define a second form on the page. It may be empty, or it may contain only a hidden form.
For example, place this after the real form:
<form method=get>
<input type="hidden">
</form
How can I have multiple Submit buttons on my form?
Although HTML won't allow multiple Submit buttons, you can simulate this with graphics that serve as
Submit buttons combined with some scripting, for example:
<script language="javascript">
<!--
function submit_Form()
{
var formVariable = document.forms[0].myLittleTextBox.value
location.href='http://name.domain/path/ISAPIApp?myLittleTextBox=' + formVariable
}
function reset_Form()
{
alert('form being reset')
document.forms[0].myLittleTextBox.value=''
}
function submit_Form_DownloadFile()
{
//code for downloading file
}
function submit_Form_ReadInformation()
{
code for reading information
}
Display Problems
How can I prevent the colors in my page from being dithered?
You should use only the 216 colors in the standard palette supported by both Internet Explorer and
Netscape Navigator to ensure that your page will look good on systems running in 256-color mode. These
colors include any combination of red, green, and blue components of 0, 51, 102, 153, 204, and 255 (hex
00, 33, 66, 99, CC, and FF). The following graphic shows all 216 colors:
Other Topics
How can I keep my page from being cached?
To keep your page from being cached (for example, if your content is dynamic and determined by a server
application), use the <META> tag as follows:
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
Note that the expiration date should be already past. <META> tags are used in the <HEAD> section of the
HTML page. Refer to http://www.w3.org/pub/WWW/Protocols/HTTP/1.1/spec.html for further
details. Internet Explorer does not support HTTP-EQUIV Pragma no-cache.
How can I display small animations in my page?
There are currently two ways to display animations: using AVI files and animated GIFs.
• AVIs are movies that can include sound and more than 256 colors. AVI files can be compressed
using a number of techniques. AVIs are currently only supported by Internet Explorer.
6. Click Edit.
7. If an action named Edit is listed, select it and click the Edit button, then proceed to step 10 below.
8. Click New.
10. Enter the command line needed to execute your desired editor in the Application used to
perform action field. You need the full path to the executable file, so it's easiest to use Browse to
locate it. Most editors require "%1" (including the quotes) after the file name.
• The ability to insert and edit (add, delete, or change cells) tables on the fly
• Ability to drag and drop any object, text, or element anywhere on the page
str = "";
for ( i=0; i<len; i++ )
<SCRIPT LANGUAGE=JavaScript>
function insertTable()
{
DHTMLEdit.ExecCommand(DECMD_INSERTTABLE,
OLECMDEXECOPT_DONTPROMPTUSER,
tableInfo);
}
</SCRIPT>
<OBJECT ID=tableInfo
CLASSID="clsid:47B0DFC7-B7A3-11D1-ADC5-006008A5848C">
<--
create the tableInfo object
give it an ID so you can reference
it in the insertTable function
&--gt;
</OBJECT>
You can also insert new HTML elements by accessing the Internet Explorer Document Object Model. The
exact method will depend on how you want to insert the HTML. If you need to insert HTML elements
relative to an existing element, the insertAdjacentHTML method is available on all elements. If you are
replacing the user selection, you can create a TextRange object and call the pasteHTML method. This
method can also be used to insert HTML at the current insertion point (caret). If you are modifying the
HTML of an existing element, you can set the innerHTML or outerHTML properties, which are available
on all elements. Note that the innerHTML property is only supported on block elements.
How do I insert script into the document?
To insert a script element into a document, use the following technique:
Dim scriptElement As String
if ( "Text" == sel.type )
{
range = sel.createRange();
alert( range.htmlText );
}
else
alert( "No text selected" );
}
How do I find the selected element or the element under the insertion point?
The following is a an example of how to use the DOM Selection and TextRange objects to retrieve the
selected element or the element directly under the insertion point:
' Assuming you have the DHTMLEdit control on
' Note that you should check the type of the selection.
' The Selection object's property "type" can return three values:
Set rg = DHTMLEdit1.DOM.selection.createRange
rg.collapse
MsgBox rg.parentElement.outerHTML
Case "Control"
' an element is site selected
' There can only be one site selected element at a time so the
' commonParentElement will return the site selected element
MsgBox ctlRg.commonParentElement.outerHTML
End Select
End Sub
How do I programatically set the position of the insertion point?
You can set the location of the insertion point programmatically by using the TextRange object. The
following code demonstrates how to set the insertion point at the end of the document:
' Assuming you have the DHTMLEdit control on
' a Visual Basic form and the control's name is DHTMLEdit1 ...
Dim range As IHTMLTxtRange
Sub DHTMLSafe1_ShowContextMenu
MsgBox "ShowContextMenu"
End Sub
-->
</SCRIPT>
<P>
<OBJECT classid=clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A
id=DHTMLSafe1></OBJECT>
</P>
</BODY>
</HTML>
To make this code work, you must insert parameters for any events which take them. The following
example shows the parameters added to the ShowContextMenu event handler.
<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub DHTMLSafe1_ShowContextMenu(x,y)
MsgBox "ShowContextMenu " & x & ", " & y
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>