|
HTML Interview Questions and Answers
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.
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>
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>
How do I create a link that opens a new window?
<a target="_blank" href=...> opens a new, unnamed
window.
<a target="example" href=...> opens a new window named
"example", provided that a window or frame by that name
does not already exist.
Note that the TARGET attribute is not part of HTML 4
Strict. In HTML 4 Strict, new windows can be created
only with JavaScript. links that open new windows can be
annoying to your readers if there is not a good reason
for them.
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:
<a href="../files/foo.zip">Download Foo Now! (100kb
ZIP)</a>
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.
A go-to-other-page button can also be coded in
JavaScript, but the above is standard HTML and works for
more readers.
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">
For the reset button, one could use <button type="reset"
...>, JavaScript, and/or style sheets, although none of
these mechanisms work universally.
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.
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 <FRAMESET ... BORDER=0
FRAMEBORDER=0 FRAMESPACING=0>.
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.
Page Numbers :
1
2
3
4
5
6
7
8
9
10
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
Job Interview Questions
for more Interview Questions with Answers
|