Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Saturday 16 August 2008

HTML Interview Questions and Answers 6

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:

Section 2: Beyond Introductions



The modern way to label the destination of the link is with an ID attribute. For example:

Section 2: Beyond Introductions



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:
go to Section 2

Similarly, in another document you could use:
go to Section 2 of my thesis

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 :
Web Authoring FAQ

How do I create a link that opens a new window?
opens a new, unnamed window.
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:
Download Foo Now! (100kb ZIP)

How do I create a button which acts like a link?
This is best done with a small 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 (), you can use the image input type (). 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:

For the reset button, one could use

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 .
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.

No comments:

Post a Comment