HTML Interview Questions

HTML Interview Questions

1. What Is Html?

HTML, or Hypertext Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet.

2. What Is A Tag?

In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to another page.

3. What Is The Simplest Html Page?

HTML Code:



<TITLE>This is my page title! </TITLE>



This is my message to the world!



Browser Display:

This is my message to the world!

4. How Do I Create Frames? What Is A Frameset?

Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.

You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element. The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should be used only with great care.

5. How Can I Include Comments In Html?

Technically, since HTML is an SGML application, HTML uses SGML comment syntax. However, the full syntax is complex, and browsers don't support it in its entirety anyway. Therefore, use the following simplified rule to create HTML comments that both have valid syntax and work in browsers:

An HTML comment begins with "<!--", ends with "-->", and does not contain "--" or ">" anywhere in the comment.

The following are examples of HTML comments:

* <! -- This is a comment. -->

* <! -- This is another comment,

And it continues onto a second line. -->

* <!---->

Do not put comments inside tags (i.e., between "<" and ">") in HTML markup.

6. What Is A Hypertext Link?

A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination.

7. What Is Everyone Using To Write Html?

Everyone has a different preference for which tool works best for them. Keep in mind that typically the less HTML the tool requires you to know, the worse the output of the HTML. In other words, you can always do it better by hand if you take the time to learn a little HTML.

8. What Is A Doctype? Which One Do I Use?

According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).

Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout mode that attempts to emulate older, buggy browsers.

9. Can I Nest Tables within Tables?

Yes, a table can be embedded inside a cell in another table. Here's a simple example:



<Td>this is the first cell of the outer table</td>

<Td>this is the second cell of the outer table,

With the inner table embedded in it



<Td>this is the first cell of the inner table</td>

<Td>this is the second cell of the inner table</td>






The main caveat about nested tables is that older versions of Netscape Navigator have problems with them if you don't explicitly close your TR, TD, and TH elements. To avoid problems, include every </tr>, </td>, and </th> tag, even though the HTML specifications don't require them. Also, older versions of Netscape Navigator have problems with tables that are nested extremely deeply (e.g., tables nested ten deep). To avoid problems, avoid nesting tables more than a few deep. You may be able to use the ROWSPAN and COLSPAN attributes to minimize table nesting. Finally, be especially sure to validate your markup whenever you use nested tables.

10. How Do I Align A Table To The Right (or Left)?

You can use <TABLE ALIGN="right"> to float a table to the right. (Use ALIGN="left" to float it to the left.) Any content that follows the closing </TABLE> tag will flow around the table. Use <BR CLEAR="right"> or <BR CLEAR="all"> to mark the end of the text that is to flow around the table, as shown in this example:

The table in this example will float to the right.

<table aligns="right">...</table>

This text will wrap to fill the available space to the left of (and if the text is long enough, below) the table.

<br clear="right">

This text will appear below the table, even if there is additional room to its left.

11. How Can I Use Tables to Structure Forms?

Small forms are sometimes placed within a TD element within a table. This can be a useful for positioning a form relative to other content, but it doesn't help position the form-related elements relative to each other.

To position form-related elements relative to each other, the entire table must be within the form. You cannot start a form in one TH or TD element and end in another. You cannot place the form within the table without placing it inside a TH or TD element. You can put the table inside the form, and then use the table to position the INPUT, TEXTAREA, SELECT, and other form-related elements, as shown in the following example.




<TH>Account :</TH>

<TD><INPUT TYPE="text" NAME="account"></TD>



<TH>Password :</TH>

<TD><INPUT TYPE="password" NAME="password"></TD>



<TD> </TD>

<TD><INPUT TYPE="submit" NAME="Log On"></TD>




12. How Do I Center A Table?

In your HTML, use

<div class="center">



In your CSS, use {

Text-align: center;

} table {

Margin-left: auto;

Margin-right: auto;

Text-align: left;


13. How Do I Use Forms?

The basic syntax for a form is: <FORM ACTION="[URL]">...</FORM>

When the form is submitted, the form data is sent to the URL specified in the ACTION attribute. This URL should refer to a server-side (e.g., CGI) program that will process the form data. The form itself should contain

* At least one submit button (i.e., an <INPUT TYPE="submit" ...> element),

* form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and

* Additional markup (e.g., identifying data elements, presenting instructions) as needed.

14. How Can I Check For Errors?

HTML validates check HTML documents against a formal definition of HTML syntax and then output a list of errors. Validation is important to give the best chance of correctness on unknown browsers (both existing browsers that you haven't seen and future browsers that haven't been written yet).

HTML checkers (linters) are also useful. These programs check documents for specific problems, including some caused by invalid markup and others caused by common browser bugs. Checkers may pass some invalid documents, and they may fail some valid ones.

All valuators are functionally equivalent; while their reporting styles may vary, they will find the same errors given identical input. Different checkers are programmed to look for different problems, so their reports will vary significantly from each other. Also, some programs that are called validate (e.g. the "CSE HTML Validated") are really linters/checkers. They are still useful, but they should not be confused with real HTML valuators.

When checking a site for errors for the first time, it is often useful to identify common problems that occur repeatedly in your markup. Fix these problems everywhere they occur (with an automated process if possible), and then go back to identify and fix the remaining problems.

Link checkers follow all the links on a site and report which ones are no longer functioning. CSS checkers report problems with CSS style sheets.

15. Do I Have To Memorize A Bunch Of Tags?

No. Most programs that help you write HTML code already know most tags, and create them when you press a button. But you should understand what a tag is, and how it works. That way you can correct errors in your page more easily.

16. How Do I Make A Form So It Can Be Submitted By Hitting Enter?

The short answer is that the form should just have one <INPUT TYPE=TEXT> and no TEXTAREA, though it can have other form elements like checkboxes and radio buttons.

17. How Do I Set The Focus To The First Form Field?

You cannot do this with HTML. However, you can include a script after the form that sets the focus to the appropriate field, like this:

<form id="my form" name="my form" action=...>

<input type="text" id="my input" name="my input" ...>


<script type="text/JavaScript">

document.myform.myinput.focus ();


A similar approach uses <body on load=...> 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.

18. How Can I Eliminate The Extra Space After A Tag?

HTML has no mechanism to control this. However, with CSS, you can set the margin-bottom of the form to 0. For example:

<form style="margin-bottom:0;" action=...>

You can also use a CSS style sheet to affect all the forms on a page:

Form {margin-bottom: 0 ; }

19. How Can I Show Html Examples Without Them Being Interpreted As Part Of My Document?

Within the HTML example, first replace the "&" character with "&amp;" everywhere it occurs. Then replace the "&lt;" character with "<" and the "&gt;" character with ">" in the same way.

Note that it may be appropriate to use the CODE and/or PRE elements when displaying HTML examples.

20. How Do I Eliminate The Blue Border Around Linked Images?

In your HTML, you can specify the BORDER attribute for the image:

<a href=...><img src=... alt=... border="0"></a>

However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.

21. How Can I Specify Colors?

If you want others to view your web page with specific colors, the most appropriate way is to suggest the colors with a style sheet. Cascading Style Sheets use the color and background-color properties to specify text and background colors. To avoid conflicts between the reader's default colors and those suggested by the author, these two properties should always be used together.

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.

Note that these attributes are deprecated by HTML 4. Also, 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">

Authors should not rely on the specified colors since browsers allow their users to override document-specified colors.

22. How Can I Allow File Uploads To My Web Site?

These things are necessary for Web-based uploads:

* An HTTP server that accepts uploads.

* Access to the /cgi-bin/ to put the receiving script. Prewritten CGI file-upload scripts are available.

* A form implemented something like this:

<form method="post" enctype="multipart/form-data" action="fup.cgi">

File to upload: <input type=file name=upfile><br>

Notes about the file: <input type=text name=note><br>

<input type=submit value=Press> to upload the file!


Not all browsers support form-based file upload, so try to give alternatives where possible.

The Perl module supports file upload. The most recent versions of the library also support file upload. Also, if you need to do file upload in conjunction with form-to-email, the Perl package MIME::Lite handles email attachments.

23. 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 module provides helpful mechanisms for returning partially completed forms to the user.

In addition, you could use JavaScript in the form's ONSUBMIT attribute to check the form data. If JavaScript support is enabled, then the ONSUBMIT event handler can inform the user of the problem and return false to prevent the form from being submitted.

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

25. How Do I Link An Image To Something?

Just use the image as the link content, like this:

<a href=...><img src=... alt=...></a>

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

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

<A HREF="">Web Authoring FAQ</A>

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

29. How Do I Create A Button Which Acts Like A Link?

This is best done with a small form:


<INPUT TYPE=submit VALUE="Text on button">


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.

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

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

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

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

33. Why Aren't My Frames The Exact Size I Specified?

Older versions of Netscape Navigator seem 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.

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

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

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

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

38. What Is The Difference Between The Html Form Methods Get And Post?

The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will find the CGI request data in:

* POST - postbags

* GET - httpargs

39. How Do I Put Sounds For Older Versions Of Internet Explorer?

For older versions of Internet Explorer, this technique was used <BG SOUND="sound.ext">.

40. Can I Use Any Html In The Box?

Yes. Any HTML tag that your browser supports will work in the box. So you can carry tags from chapters to chapters and mix and match.

41. What Does The "access Is Denied" Ie Error Mean?

The "Access Denied" error in any browser is due to the following reason.

A JavaScript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.

42. Is A Javascript Script Faster Than An Asp Script?

Yes. Since java script is a client-side script it does require the web server's help for its computation, so it is always faster than any server-side script like ASP, PHP, etc...

43. Are Java And Javascript The Same? and java script are two different languages.

Java is a powerful object - oriented programming language like C++,C whereas Javascript is a client-side scripting language with some limitations.

44. How To Embed Javascript In A Web Page?

JavaScript code can be embedded in a web page between <script language="java script"></script> tags

45. What And Where Are The Best Javascript Resources On The Web?

 The best place to start is something called the meta- which provides a high-level overview of the JavaScript help available on the Net.

For interactive help with specific problems, nothing beats the primary JavaScript Usenet newsgroup, comp.lang.javascript. Netscape and Microsoft also have vendor-specific developer discussion groups as well as detailed documentation for the scripting and object model implementations.

46. What Are The Problems Associated With Using Javascript, And Are There Javascript Techniques That You Discourage?

Browser version incompatibility is the biggest problem. It requires knowing how each scriptable browser version implements its object model. You see, the incompatibility rarely has to do with the core JavaScript language (although there have been improvements to the language over time); the bulk of incompatibility issues have to do with the object models that each browser version implements. For example, scripter’s who started out with Navigator 3 implemented the image rollover because it looked cool. But they were dismayed to find out that the image object wasn't scriptable in Internet Explorer 3 or Navigator 2. While there are easy workarounds to make this feature work on newer browsers without disturbing older ones, it was a painful learning experience for many.

The second biggest can of worms is scripting connections between multiple windows. A lot of scripter’s like to have little windows pop up with navigation bars or some such gizmos. But the object models, especially in the older browser versions, don't make it easy to work with these windows the minute you put a user in front of them--users who can manually close windows or change their stacking order. More recently, a glitch in some uninstall routines for Windows 95 applications can disturb vital parts of the system Registry that Internet Explorer 4 requires for managing multiple windows. A scripter can't work around this problem, because it's not possible to detect the problem in a user's machine. I tend to avoid multiple windows that interact with each other.

47. What Boolean Operators Does Javascript Support?




48. What Does "1"+2+4 Evaluate To?

Since 1 is a string, everything is a string, so the result is 124.

49. What Is The Difference Between A Web-garden And A Web-farm?

Web-garden - An IIS6.0 feature where you can configure an application pool as a web-garden and also specify the number of worker processes for that pool. It can help improve performance in some cases.

Web-farm - a general term referring to a cluster of physically separate machines, each running a web-server for scalability and performance (contrast this with web-garden which refers to multiple processes on one single physical machine).

50. How To Get The Contents Of An Input Box Using Javascript?

Use the "value" property.

Var myValue = window.document.getElementById ("My Textbox").value;

51. How To Determine The State Of A Checkbox Using Javascript?

Var checked = window.document.getElementById ("my Checkbox").checked;

52. How To Set The Focus In An Element Using Javascript?

<script> function set Focus() { if(focus Element != null) { document. forms[0].elements["myelementname"].focus(); } } </script>

53. How To Access An External Javascript File That Is Stored Externally And Not Embedded?

This can be achieved by using the following tag between head tags or between body tags.

<script src="abc.js"></script>

Where abc.js is the external JavaScript file to be accessed.

54. What Is The Difference Between An Alert Box And A Confirmation Box?

An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.

55. What Is A Prompt Box?

A prompt box allows the user to enter input by providing a text box.

56. Can Javascript Code Be Broken In Different Lines?

Breaking is possible within a string statement by using a backslash at the end but not within any other java script statement. That is,

Document. Write ("Hello world");

Is possible but not document. Write

("Hello world");

57. Taking A Developer’s Perspective, Do You Think That That Javascript Is Easy To Learn And Use?

One of the reasons JavaScript has the word "script" in it is that as a programming language, the vocabulary of the core language is compact compared to full-fledged programming languages. If you already program in Java or C, you actually have to unlearn some concepts that had been beaten into you. For example, JavaScript is a loosely typed language, which means that a variable doesn't care if it's holding a string, a number, or a reference to an object; the same variable can even change what type of data it holds while a script runs.

The other part of JavaScript implementation in browsers that makes it easier to learn is that most of the objects you script are pre-defined for the author, and they largely represent physical things you can see on a page: a text box, an image, and so on. It's easier to say, "OK, these are the things I'm working with and I'll use scripting to make them do such and such," instead of having to dream up the user interface, conceive of and code objects, and handle the interaction between objects and users. With scripting, you tend to write a _lot_ less code.

58. What Web Sites Do You Feel Use Javascript Most Effectively (i.e., Best-in-class Examples)? The Worst?

The best sites are the ones that use JavaScript so transparently, that I'm not aware that there is any scripting on the page. The worst sites are those that try to impress me with how much scripting is on the page.

59. What Is The Difference Between Session state And View state?

View State is specific to a page in a session. Session state refers to user specific data that can be accessed across all pages in the web application.

60. What Does The Enableviewstatemac Setting In An Aspx Page Do?

Setting EnableViewStateMac=true is a security measure that allows ASP.NET to ensure that the view state for a page has not been tampered with. If on Post back, the ASP.NET framework detects that there has been a change in the value of view state that was sent to the browser, it raises an error - Validation of view state MAC failed.

Use <%@ Page EnableViewStateMac="true"%> to set it to true (the default value, if this attribute is not specified is also true) in an aspx page.

61. What Is Html5?

HTML or Hypertext Markup Language is a formatting language that programmers and developers use to create documents on the Web. The latest edition HTML5 has enhanced features for programmers such as <video>, <audio> and <canvas> elements. You view a Web page written in HTML in a Web browser such as Internet Explorer, Mozilla Firefox or Google Chrome. The HTML5 language has specific rules that allow placement and format of text, graphics, video and audio on a Web page. Programmers use these programming tags or elements to produce web pages in unique and creative ways. Tags such as <section>, <article>, <header> enable the creator to make a more efficient and intelligent web page. Users will not have to use a Flash plug-in for video and audio content. Visual Studio users typically write code in HTML5 when creating web site content.

62. Describe Any Two New Features Of Html5?

HTML 5 comes up with many new features including video/audio elements for media playback and better support for local offline storage.

63. What does A <hgroup> Tag Do?

It is used for heading sections. Header tags used are from <h1> to <h6>. The largest is the main heading of the section, and the others are sub-headings.

64. Which Video Formats Are Used For The Video Element?

Ogg, MPEG4, WebM.

65. How Can We Embed Video In Html5?

<video src="movie.ogg" controls="controls"></video>

66. Which Video Format Is Supported By Ie?

IE supports MPEG4 and WebM.

67. Name The Audio Formats Supported In Html5?

Ogg Vorbis, MP3, WAV.

68. What Will The Following Code Do?

<audio Src="song.ogg" Controls="controls"></audio>

It will play the audio file named song.ogg.

69. How Will You Define Canvas With Reference To Html5?

It is a rectangular area, where we can control every pixel.

70. Give An Example Of Adding Canvas In Html5?

<canvas id="my Canvas" width="200" height="100"></canvas>

71. What Is The Difference Between Html And Html5?

HTML5 is nothing more then upgraded version of HTML where in HTML5 Lot of new future like Video, Audio/mp3, date select function , placeholder , Canvas, 2D/3D Graphics, Local SQL Database added so that no need to do external plug-in like Flash player or other library.

72. What Is The <! Doctype >? Is It Necessary To Use In Html5?

The <! DOCTYPE> is an instruction to the web browser about what version of HTML the page is written in. AND The <! DOCTYPE> tag does not have an end tag and It is not case sensitive.

The <! DOCTYPE> declaration must be the very first thing in HTML5 document, before the <html> tag. As In HTML 4.01, all <! DOCTYPE > declarations require a reference to a Document Type Definition (DTD), because HTML 4.01 was based on Standard Generalized Markup Language (SGML). WHERE AS HTML5 is not based on SGML, and therefore does not require a reference to a Document Type Definition (DTD).

73. How Many New Markup Elements You Know In Html5?

Below are the New Markup Elements added in HTML5

74. What Are The New Media Elements In Html5? Is Canvas Element Used In Html5?

Below are the New Media Elements have added in HTML5

Yes we can use Canvas element in html5 like below


75. Do You Know New Input Type Attribute In Html5?

Yes we can use below new input type Attribute in HTML5

Type                       Value

Tel               The input is of type telephone number

Search                   The input field is a search field

URL            a URL

Email          One or more email addresses

Date time       A date and/or time

Date            A date

Month         A month

Week          A week

Time           The input value is of type time

Date time-local         A local date/time

Number                  A number

Range                    A number in a given range

Color          A hexadecimal color, like #82345c

Placeholder  Specifies a short hint that describes the expected value

                Of an input field

76. How To Add Video And Audio In Html5?

Like below we can add video in html5

   <video width="320" height="240" controls="controls">

    <source src="pcds.mp4" type="video/mp4" />

    <source src="pcds.ogg" type="video/ogg" />


And audio like this

  <audio controls="controls">

  <source src="song.ogg" type="audio/ogg" />

  <source src="song.mp3" type="audio/mpeg" />


77. What The Use Of Canvas Element In Html5?

The canvas element is used to draw graphics images on a web page by using javascript like below

<canvas id="pcdsCanvas" width="500" height="400"></canvas>

<script type="text/java script">

Var pcdsCanvas=document.getElementById ("pcdsCanvas");

Var pcdsText=pcdsCanvas.getContext ("2d");


pcdsText.fillRect (0,0,150,75);


78. What Is the Use Of Local storage In Html5?

Before HTML5 Local Stores was done with cookies. Cookies are not very good for large amounts of data, because they are passed on by every request to the server, so it was very slow and in-effective.

In HTML5, the data is NOT passed on by every server request, but used ONLY when asked for. It is possible to store large amounts of data without affecting the website's performance and the data is stored in different areas for different websites, and a website can only access data stored by itself.

And for creating local stores just need to call local Storage object like below we are storing name and address

<script type="text/java script">"PCDS";

Document. Write (;


<script type="text/java script">

localStorage.address="Mumbai India..";

Document. Write (localStorage.address);


79. What Is The Session storage Object In Html5? How To Create And Access?


The session Storage object stores the data for one session. The data is deleted when the user closes the browser window. like below we can create and access a session Storage here we created "name" as session:

<script type="text/java script">"PCDS";

Document. Write (;


80. What’s New Html 5 Doctype And Charset?

Normally for HTML files first line of code is DocType which basically tells browser about specific version of HTML. HTML5 is now not subset of SGML. As compared to previous version/standards of HTML, DocType is simplified as follows:

                  <!doctype html>

And HTML 5 uses UTF-8 encoding as follows:

                 <Meta charset=”UTF-8″>

81. How Can We Embed Audio In Html5?

HTML 5 comes with a standard way of embedding audio files as previously we don’t have any such support on a web page. Supported audio formats are as follows:




Below is the most simple way to embed an audio file on a web page.

<Audio controls>

    <source src=”jamshed.mp3″ type=”audio/mpeg”>

    Your browser doesn’t support audio embedding feature.


In above code, src value can be relative as well as absolute URL. We can also use multiple <source> elements pointing to different audio files. There are more new attributes for <audio> tag other than src as below:

•controls – it adds controls such as volume, play and pause.

•auto play – it’s a Boolean value which specifies that audio will start playing once it’s ready.

•loop – it’s also a Boolean value which specifies looping (means it automatically start playing after it ends).

•preload – auto, metadata and none are the possible values for this attribute.

     •auto means plays as it loaded.

     •metadata displays audio file’s associated data

     •none means not pre-loaded.

82. What Are The New Media Element In Html 5 Other Than Audio And Video?

HTML 5 has strong support for media. Other than audio and video tags, it comes with the following tags:

<Embed> Tag: <embed> acts as a container for external application or some interactive content such as a plug-in. Special about <embed> is that it doesn’t have a closing tag as we can see below:

<embed type=”video/quick time” src=””>

<Source> Tag: <source> is helpful for multiple media sources for audio and video.

<video width=”450″ height=”340″ controls>

     <source src=”jamshed.mp4″ type=”video/mp4″>

     <source src=”jamshed.ogg” type=”video/ogg”>


<Track> Tag: <track> defines text track for media like subtitles as:

<video width=”450″ height=”340″ controls>

     <source src=”jamshed.mp4″ type=”video/mp4″>

     <source src=”jamshed.ogg” type=”video/ogg”>

     <track kind=”subtitles” label=”English” src=”jamshed_en.vtt” srclang=”en” default></track>

      <track kind=”subtitles” label=”Arabic” src=”jamshed_ar.vtt” srclang=”ar”></track>


83. What Are The Different Types Of Storage In Html 5?

HTML 5 has the capability to store data locally. Previously it was done with the help of cookies. Exciting thing about this storage is that its fast as well as secure.

There are two different objects which can be used to store data.

•local Storage object stores data for a longer period of time even if the browser is closed.

•session Storage object stores data for a specific session.

84. What Are The Deprecated Elements In Html5 From Html4?

Elements that are deprecated from HTML 4 to HTML 5 are:








85. What Are The New Apis Provided By Html 5 Standards?

HTML 5 standards comes with a number of new APIs. Few of it are as follows:

•Media API

•Text Track API

•Application Cache API

•User Interaction

•Data Transfer API

•Command API

•Constraint Validation API

•History API

•and many more

86. What Is The Difference Between Html 5 Application Cache And Regular Html Browser Cache?


One of the key features of HTML 5 is “Application Cache” that enables us to make an offline version of a web application. It allows to fetch few or all of website contents such as HTML files, CSS, images, java script etc locally. This feature speeds up the site performance. This is achieved with the help of a manifest file defined as follows:

<! Doctype html>


As compared with traditional browser caching, it’s not compulsory for the user to visit website contents to be cached.

In order to achieve Application Cache feature in HTML5, a manifest file is used as follows:

<! Doctype html>


Manifest file is basically a text file that dictates what needs to be cache or not if Application Cache is enabled. Followings are the four main sections of a manifest file where CACHE MANIFEST is the only required section:





87. What Is Web Forms 2.0 In Html5?

Forms Section in HTML5 is known as Web Forms 2.0. It’s basically an extension to HTML4 forms features. Web Forms 2.0 in HTML5 provides comparatively a greater degree of semantic markups than HTML4 as well as removing the need of lengthy and tedious scripting and styling, as a result making HTML5 more richer but simpler in use.

88. Briefly Explain Cache Manifest File In Html5 With An Example?

Cache manifest file is simply a text file that dictates the browser, what to store for offline access? It basically list down the required resources for offline access.

</> Following is an example of a simple manifest file:





So, the resources mentioned in above manifest file (decorate.css, work.js, and amazing.jpg) will be downloaded and cached locally for offline access.

89. What Is An Html5 Web Worker?

Normally if some script is executing in an HTML page, the page remains unresponsive until the scripts execution stops. But an HTML5 web worker is a script (i.e. JavaScript) that keeps executing in background. At the same time user can interact with the page and will not feel any performance degradation.HTML5 Web Worker

HTML5 web worker normally exists in external files and used for long-running CPU intensive tasks but without affecting the User Interface or other scripts.

90. What Are The Limitations Of Html5 Web Worker?

HTML5 Web worker seems to be very handy in many scenarios (especially for CPU intensive tasks) but it has certain limitations. Few JavaScript objects are not accessible to HTML5 web worker as:

•parent object

•window object

•document object

91. What Is Xhtml?

XHTML stands for Extensible Hyper-Text Markup Language.  XHTML is a scripting language that authors can use to embed text tags into a text document to add structural and formatting information.

More precisely, XHTML gives authors the means to:

Publish online documents with headings, text, tables, lists, photos, etc.

Retrieve online information via hypertext links, at the click of a button.

Design forms for conducting transactions with remote services, for use in searching for information, making reservations, ordering products, etc.

Include spread-sheets, video clips, sound clips, and other applications directly in their documents.

92. What Does An Xhtml Document Look Like?

An XHTML  document  is a normal text file with predefined  tags mixed with the text contents of the document. Tags are enclosed in pairs of angle brackets:  "<" and ">".

Below is how a simple XHTML  document  will look like if you open it in a text editor:

<?xml version="l.O"  encoding="UTF-8"?>

<!DOCTYPE  html PUBLIC  "-//W3C//DTD  XHTML  1.0 Strict//EN" "">



<title>My First XHTML  Document</title>



<p>Hello  world!</p>



93. What Is The Relation Between Xhtml And Html?

HTML  (Hyper-Text  Markup Language)  is the original markup language for writing Web documents.

XHMTL  1. 0 is basically the same language as HTML 4. 0. But XHTML  1.0 is defined in XML1.0 syntax. XHTML  1.0 offers the following  features:

XHTML  documents  are XML conforming.  As such, they are readily viewed,  edited, and validated  with standard XML tools.

XHTML  documents  can be written to operate as well or better than they did before in existing HTML 4-conforming  user agents as well as in new, XHTML  1.0 conforming  user agents.

XHTML  documents  can utilize applications  (e.g. scripts and applets) that rely upon either the HTML Document  Object Model or the XML Document  Object Model.

94. What Is The Relation Between Xhtml And Xml?

XML (Extensible Markup Language)  is a generic markup  language to organize generic information  into a structured  document  with embedded tags.

XHTML  is entirely based on XML. You can actually say that XHTML  is a child language of XML.

95. What Is The Relation Between Xhtml And The Web?

The Web is a publisher technology  based on the Internet to allow publishers  to publish hyper linked documents  to be viewed by Internet users.

XHTML  is the next generation  language that used to compose those hyper linked documents.  In another word, XHTML  is the technical  language that controls Web page contents and hyper links.

96. What Is The Relation Between Xhtml And Http?

HTTP (Hyper-Text  Transfer Protocol)  is an Internet  communication  protocol, that allows a viewer's computer talking to a publisher's  computer to fetch XHTML  documents.

The viewer's computer  issues a HTTP request message to the publisher  computer first. Then the publisher returns a HTTP response message back to the viewer's computer  with the requested XHTML  document  included in the message.

The following diagram shows how HTTP works with XHTML  documents: HTTP Diagram

97. What Is The Relation Between Xhtml And Url?

URL (Uniform Resource  Locator) is a compact  string representation  of the location for a Web document  or other resource that is available on the Internet.

The URL of an XHTML  document  is usually the document file name prefixed with the domain name of your Web server and the http protocol name. As soon as you uploaded  an XHTML document to a Web server, that document will have a URL to represent  its location on the Internet.

For example: if you have a Web server with domain name like, and you have uploaded  an XHTML  document called welcome.html,then the URL of that XHTML document  on the Internet is

98. What Is The Relation Between Xhtml And Sgml?

SGML (Standard  Generalized  Markup Language)  is a metalanguage  in which one can define markup  languages,  like HTML, for documents.  SGML is a descendant  of IBM's Generalized Markup Language  (GML), developed  in the 1960s by Charles  Goldfarb, Edward Mosher and Raymond  Lorie (whose surname initials also happen to be GML).

XHTML  is not directly related to SGML. But it is indirectly to SGML through HTML.

99. What Is The Relation Between Xhtml And Css?

CSS (Cascading  Style Sheets) is a technical  specification  that allows XHTML  document authors to attach formatting  style sheets to XHTML  documents.  When XHTML  documents  are viewed as Web pages through Web browsers,  the attached style sheets will alter the default style sheets embedded  in browsers.

100. What Is The Relation Between Xhtml And Dtd?

DTD (Document  Type Definition)  is a language based on XML to you to define a specific type of XML documents.

Since XHTML  is a specific type of XML documents,  you can use DTD to define the structure of XHTML.

 101. What Is An Xhtml Element Attribute?

An element attribute  is a predefined  property about this element. Element  attributes  allows you to provide additional  information  to the element. Most XHTML  elements have some common attributes. But many XHTML  elements have their own specific attributes.

Here are some good examples  of element attributes:

<br/> - No attribute.

<script type="text/javascript">   - One attribute:  "type".

<p class="sideNote">  - One attribute:  "class".

<meta name="Author"  content=""/>    - Two attributes:  ~  <img src="ggl.gif''  alt="ggl"/>  - Two attributes:  "src" and "alt".

102. Is Xhtml Element Name Case Sensitive?

Yes, XHTML  element names are case sensitive. All element names must be written in lower case letters.

Here are some valid and invalid XHTML  element names:

<html> - Valid name.

<HTML>  - Invalid name, must use lower case letters.

<xhtml>  - Invalid name, not defined by XHTML  specification.

<Body>  - Invalid name, must use lower case letters.

Note to HTML document authors: HTML  element names are not case sensitive. But XHTML element names are case sensitive. If you are converting  existing HTML documents to XHTML documents,  you will get a lots of syntax errors about upper case letters used in HTML tags.

103. How To Enterelement Content?

Most ofXHML elements allow you to specify contents. But there are some XHTML  elements that do not allow any contents. If an XHTML  element does allow element content, you need to enter the content between the opening tag and the closing tag.

Here  are  some  good  examples   ofXHTML   elements   with  contents:

~   <title>My   First  XHTML   Document</title>

~   <p> A very  long  paragraph   ... </p>

~   <hl>  XHTML   Tutorials   by</hl>

104. What Is Wrongwith My <meta> Tags?

If you are converting  existing HTML documents  to XHTML  format, you may find some <meta>

tags are written as:

<meta name="Author"  content="">

<meta name="Description"

content="Tutorials,  FAQs and Tips on XHTML Documents.">

<meta name="Keywords"

content="XHTML  Tutorials, FAQs, Tips">

But all those <meta> tags are invalid in a XHTML  document.  They must be closed as:

<meta name="Author"  content=""/>

<meta name="Description"

content="Tutorials,  FAQs and Tips on XHTML Documents."/>

<meta name="Keywords"

content="XHTML  Tutorials, FAQs, Tips"/>

Note to HTML document authors: <meta> tag syntax in XHTML  is the opposite to <meta> tag syntax in HTML. In XHTML,  meta tag must be closed. But in HTML, meta tag cannot be closed.

105. What Is Wrong with My <br> Tags?

If you are used HTML  syntax, you may write your <br> tags as in the paragraph  below:


I love  the  way  you  look  at me, <br> Your  eyes  so bright  and  blue.<br>

I love  the  way  you  kiss  me,<br>

Your  lips  so soft  and  smooth.<br>


But  that  paragraph   will  be invalid  as XHTML   documents,    because   all 4 <br>  are not  closed.  You should  change   it to:


I love  the  way  you  look  at me, <br/> Your  eyes  so bright  and  blue.<br/>

I love  the  way  you  kiss  me,<br/> Your  lips  so soft  and  smooth.<br/>


106. How To Close An Xhtml Element?

Every XHTML  element must be closed. There are two ways to close an XHTML  element:

Using a closing tag, which is the element name prefixed with"/"  and enclosed in a pair of angle brackets:  "<"and">".

Closing the opening tag immediately  by placing  "/" before the ending bracket:  ">".

Here are some good examples  of closing XHTML  elements:

<html>   </html>-  Closing the html element with a closing tag.

<head>   </head>  - Closing the head element with a closing tag.

<title/> - Closing the title element immediately  with no content.

<body> ... </body>  - Closing the body element with a closing tag.

<p> ... </p> - Closing the p element with a closing tag.

<script/>  - Closing the script element immediately  with no content.

107. How To Writethe Opening Tag Of An Xhtml Element?

When you are writing an XHTML  element, you must start with its opening tag, which contains the name of the element and attributes if needed. The opening tag is enclosed in a pair of angle brackets:"<"   and">".

XHTML  element names are predefined  by the XHTML  specification. 

You can not make up your own tag names. Here are some good examples  ofXHTML element opening tags:

<html> - Opening tag of the html element.

<head> - Opening tag of the head element.

<title> - Opening tag of the title element.

<body> - Opening tag of the body element.

<p> - Opening tag of the p element.

<script>  - Opening tag of the script element.

108. How To Entercomments Into Xhtml Documents?

If you want to enter comments  into an XHTML  document, you can use the comment tag: "<!-- ...


Here are some good examples  ofXHTML comments:

<!-- Start north banner-->  ...

<script type="text/javascript">

<!-- alert("Are  you ok?"); -->

</script> ...

<!--A  long   . paragraph    .

of comments-->  ...

109. What Is An Xhtml Element?

An XHTML  element is the basic building block of an XHTML  document.  An XHTML  element has the following features:

An XHTML  element must have a name.

An XHTML  element may have zero or more attributes.

An XHTML  element may or may not have any content. Here is a good example of an XHTML  element:

<a href="http ://www. glo balguideline. com/">globalguideline.  com</ a>

The above an XHTML  element has:

A name called "a", which is coded at the beginning  of the opening tag.

An attribute  called "href'', which is coded inside the opening tag. It also has a value specified after the "=" sign.

A string of text as the content, which is coded between the opening tag and closing tag.

110. What Tools To Use To View Xhtml Documents?

The basic tool you need to view XHTML  documents  is any Web browser,  like Internet Explorer(IE) or FireFox.

The following tutorial shows you how to view a XHTML  document with :

Write    an XHTML  document  and save it as hello.html.

Run IE and select the File > Open menu. The Open dialog box shows up.

Use the Browse button to find and select your XHTML  document,  hello.html.

Click OK, IE will open hello.html  and let you view it.

Here is a how your XHTML  document,  hello.html,  will look like if viewing  it with IE: Hello in IE.

111. What Tools To Use To Writexhtml Documents?

The basic tool you need to write XHTML  documents  is any text editor, like notepad  on Windows system, or vi on Unix system.

If you are looking for some advanced  tools to help you writing XHTML documents, you can select any one from the following three categories of XHTML editors:

Text based editor: Allows you to work on the text version of the XHTML  document.

WYSIWYG  editor: Allows you to work on the rendered version of the XHTML  document.

Browser  based editor: A WYSIWYG  editor integrated  into an existing Web browser.

XHTML editors can also be loaded with additional   functionalities to allow you  work  with  other Web  technologies like  CSS  and  JavaScript,or publish the XHTML documents to your Web server.

112. How To Validate Xhtml Documents Online?

If you have just finished a new XHTML  document, and you want to make sure that confirms with the XHTML  specification.

There are 3  ways you can use this validator:

By URL: Specify the URL where your XHTML  document  is located, and click "Check".

By File Upload: Use the "Browse" to locate an XHTML  document on your local hard disk, and click "Check".

By Direct Input: Copy & paste the content of an XHTML  document to the input area, and click "Check".

The validator will return a page with validation  result.

113. How Many Tags Are Defined In Xhtml 1.0?

There are 77 tags defined in XHTML  1.0:

a abbr acronym address area b base bdo big blockquote body br button caption cite code col colgroup dd del dfn div dl dt em fieldset form hl  h2 h3 h4 h5 h6 head hr html i img input inskbd label legend li link map meta noscript object oloptgroup option p param pre q samp script select small span strong style sub sup table tbody td textarea tfoot th thead title tr tt ul var.

114. What Is The Latest Xhtml Specification?

The latest XHTML  specification  is XHTML  1. 0 second edition revised in August, 2002 by W3C.

115. Who Developed Xhtml?

XHTML  was developed by W3C HTML Working  Group with Steven Pemberton  as the group chair.

116. What Is Javascript?

JavaScript is a general-purpose programming language designed to let programmers of all skill levels control the behavior of software objects. The language is used most widely today in Web browsers whose software objects tend to represent a variety of HTML elements in a document and the document itself. But the language can be--and is--used with other kinds of objects in other environments. For example, Adobe Acrobat Forms uses JavaScript as its underlying scripting language to glue together objects that are unique to the forms generated by Adobe Acrobat. Therefore, it is important to distinguish JavaScript, the language, from the objects it can communicate with in any particular environment. When used for Web documents, the scripts go directly inside the HTML documents and are downloaded to the browser with the rest of the HTML tags and content.

JavaScript is a platform-independent,event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.

117. How Is Javascript Different From Java?

JavaScript was developed by Brendan Eich of Netscape; Java was developed at Sun Microsystems. While the two languages share some common syntax, they were developed independently of each other and for different audiences. Java is a full-fledged programming language tailored for network computing; it includes hundreds of its own objects, including objects for creating user interfaces that appear in Java applets (in Web browsers) or standalone Java applications. In contrast, JavaScript relies on whatever environment it's operating in for the user interface, such as a Web document's form elements.

JavaScript was initially called LiveScript at Netscape while it was under development. A licensing deal between Netscape and Sun at the last minute let Netscape plug the "Java" name into the name of its scripting language. Programmers use entirely different tools for Java and JavaScript. It is also not uncommon for a programmer of one language to be ignorant of the other. The two languages don't rely on each other and are intended for different purposes. In some ways, the "Java" name on JavaScript has confused the world's understanding of the differences between the two. On the other hand, JavaScript is much easier to learn than Java and can offer a gentle introduction for newcomers who want to graduate to Java and the kinds of applications you can develop with it.

118. What’s Relationship Between Javascript And Ecmascript?

ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.

119. How Do You Submit A Form Using Javascript?

Use document. Forms [0].submit ();

(0 refers to the index of the form – if you have more than one form in a page, then the first one has the index 0, second has index 1 and so on).

120. Is There A Site That Shows Which Tags Work On Which Browsers?

There have been several attempts to do this, but I'm not aware of any really good source of comparisons between the browsers. The trouble is that there are many different versions of each browser, and many different tags. All current browsers should support the tags in the official HTML 3.2 specification, but the major ones also support nonstandard tags and sometimes have slightly different implementations. One place that has fairly good compatibility info is Browsercaps.

121. Why Does The Browser Show My Plain Html Source?

If Microsoft Internet Explorer displays your document normally, but other browsers display your plain HTML source, then most likely your web server is sending the document with the MIME type "text/plain". Your web server needs to be configured to send that filename with the MIME type "text/html". Often, using the filename extension ".html" or ".htm" is all that is necessary. If you are seeing this behavior while viewing your HTML documents on your local Windows filesystem, then your text editor may have added a ".txt" filename extension automatically. You should rename filename.html.txt to filename.html so that Windows will treat the file as an HTML document.

122. How Can I Display An Image On My Page?

Use an IMG element. The SRC attribute specifies the location of the image. The ALT attribute provides alternate text for those not loading images. For example:

<img src="logo.gif" alt="ACME Products">

123. Why Do My Links Open New Windows Rather Than Update An Existing Frame?

If there is no existing frame with the name you used for the TARGET attribute, then a new browser window will be opened, and this window will be assigned the name you used. Furthermore, TARGET="_blank" will open a new, unnamed browser window.

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.

124. How Do I Get Out Of A Frameset?

If you are the author, this is easy. You only have to add the TARGET attribute to the link that takes readers to the intended 'outside' document. Give it the value of _top.

In many current browsers, it is not possible to display a frame in the full browser window, at least not very easily. The reader would need to copy the URL of the desired frame and then request that URL manually.

I would recommend that authors who want to offer readers this option add a link to the document itself in the document, with the TARGET attribute set to _top so the document displays in the full window if the link is followed.

125. When I Try To Upload My Site, All My Images Are X's. How Do I Get Them To Load Correctly?

They are a few reasons that this could happen. The most common are:

You're attempting to use a .bmp or .tif or other non-supported file format. You can only use .gif and .jpg on the web. You must convert files that are not .gif or .jpg into a .gif or .jpg with your image/graphics program.

You've forgotten to upload the graphic files. Double-Check.

You've incorrectly linked to the images. When you are starting out, try just using the file name in the  tag. If you have cat.jpg, use

img src="cat.jpg">.

Image file names are case-sensitive. If your file is called CaT.JpG, you cannot type cat.jpg, you must type CaT.JpG exactly in the src.

If all of the above fail, re-upload the image in BINARY mode. You may have accidentally uploaded the image in ASCII mode.

126. How Do I Make A Frame With A Vertical Scrollbar But Without A Horizontal Scrollbar?

The only way to have a frame with a vertical scrollbar but without a horizontal scrollbar is to define the frame with SCROLLING="auto" (the default), and to have content that does not require horizontal scrolling. There is no way to specify that a frame should have one scrollbar but not the other. Using SCROLLING="yes" will force scrollbars in both directions (even when they aren't needed), and using SCROLLING="no" will inhibit all scrollbars (even when scrolling is necessary to access the frame's content). There are no other values for the SCROLLING attribute.

127. Are There Any Problems With Using Frames?

The fundamental problem with the design of frames is that framesets create states in the browser that are not addressable. Once any of the frames within a frameset changes from its default content, there is no longer a way to address the current state of the frameset. It is difficult to bookmark - and impossible to link or index - such a frameset state. It is impossible to reference such a frameset state in other media. When the sub-documents of such a frameset state are accessed directly, they appear without the context of the surrounding frameset. Basic browser functions (e.g., printing, moving forwards/backwards in the browser's history) behave differently with framesets. Also, browsers cannot identify which frame should have focus, which affects scrolling, searching, and the use of keyboard shortcuts in general.

Furthermore, frames focus on layout rather than on information structure, and many authors of framed sites neglect to provide useful alternative content in the NOFRAMES element. Both of these factors cause accessibility problems for browsers that differ significantly from the author's expectations and for search engines.

128. How Do I Keep People From Stealing My Source Code And/or Images?

Because copies of your HTML files and images are stored in cache, it is impossible to prevent someone from being able to save them onto their hard drive. If you are concerned about your images, you may wish to embed a watermark with your information into the image. Consult your image editing program's help file for more details.

The colors on my page look different when viewed on a Mac and a PC. The Mac and the PC use slightly different color palettes. There is a 216 "browser safe" color palette that both platforms support; the Microsoft color picker page has some good information and links to other resources about this. In addition, the two platforms use different gamma (brightness) values, so a graphic that looks fine on the Mac may look too dark on the PC. The only way to address this problem is to tweak the brightness of your image so that it looks acceptable on both platforms.

129. How Do You Create Tabs Or Indents In Web Pages?

There was a tag proposed for HTML 3.0, but it was never adopted by any major browser and the draft specification has now expired. You can simulate a tab or indent in various ways, including using a transparent GIF, but none are quite as satisfactory or widely supported as an official tag would be.

My page looks good on one browser, but not on another. There are slight differences between browsers, such as Netscape Navigator and Microsoft Internet Explorer, in areas such as page margins. The only real answer is to use standard HTML tags whenever possible, and view your pages in multiple browsers to see how they look.

130. How Do I Make Sure My Framed Documents Are Displayed Inside Their Frame Set?

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.href.replace)



// causes problems with back button, but works

window.location.href = 'frameset.html';



A more universal approach is a "restore frames" link:

<A HREF="frameset.html" TARGET="_top">Restore Frames

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.

131. How Do I Update Two Frames At Once?

There are two basic techniques for updating multiple frames with a single link: The HTML-based technique links to a new frameset document that specifies the new combination of frames. The JavaScript-based solution uses the onClick attribute of the link to update the additional frame (or frames).

The HTML-based technique can link to a new frameset document with the TARGET="_top" attribute (replacing the entire frameset). However, 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">


<!-- Alternative non-framed version -->



A link can now use the TARGET="Display" attribute to replace simultaneously all the frames defined by the frameset2.html document.

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

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

132. What Is Html?

HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet.

HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You are looking at a Web page right now.

You can view HTML pages in two ways:

One view is their appearance on a Web browser, just like this page -- colors, different text sizes, graphics.

The other view is called "HTML Code" -- this is the code that tells the browser what to do.

133. What Is A Tag?

In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to another page.

134. What Is The Simplest Html Page?

HTML Code:



<TITLE>This is my page title! </TITLE>



This is my message to the world!



Browser Display:

This is my message to the world!

135. How Do I Create Frames? What Is A Frameset?

Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.

You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element.

The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should be used only with great care.

136. What Is A Hypertext Link?

A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination.

137. What Does Break And Continue Statements Do?

Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.

138. How To Create A Function Using Function Constructor?

The following example illustrates this

It creates a function called square with argument x and returns x multiplied by itself.

var square = new Function ("x","return x*x");

139. How To Make A Array As A Stack Using Javascript?

The pop() and push() functions turn a harmless array into a stack

<script type="text/javascript">

var numbers = ["one", "two", "three", "four"];







This produces


140. How To Shift And Unshift Using Javascript?

<script type="text/javascript">

var numbers = ["one", "two", "three", "four"];


document.write(" "+numbers.shift());

document.write(" "+numbers.shift());

document.write(" "+numbers.shift());


This produces

zero one two

shift, unshift, push, and pop may be used on the same array. Queues are easily implemented using combinations.

141. What Are Javascript Types?

Number, String, Boolean, Function, Object, Null, Undefined.

142. How Do You Convert Numbers Between Different Bases In Javascript?

Use the parseInt() function, that takes a string as the first parameter, and the base as a second parameter. So to convert hexadecimal 3F to decimal, use parseInt ("3F", 16);

143. How To Create Arrays In Javascript?

We can declare an array like this

Var scripts = new Array();

We can add elements to this array like this

Scripts [0] = "PHP";

Scripts [1] = "ASP";

Scripts [2] = "JavaScript";

Scripts [3] = "HTML";

Now our array scrips has 4 elements inside it and we can print or access them by using their index number. Note that index number starts from 0. To get the third element of the array we have to use the index number 2 . Here is the way to get the third element of an array.

document.write (scripts [2]);

We also can create an array like this

var no array = new Array(21, 22, 23, 24, 25);

144. How Do You Target A Specific Frame From A Hyperlink?

Include the name of the frame in the target attribute of the hyperlink. <a href=”mypage.htm” target=”my frame”>>My Page</a>

145. What Can Javascript Programs Do?

Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client's machine The user's browser, OS, screen size, etc. can be detected Date and Time Handling

146. How To Set A Html Document's Background Color?

Document. Bgcolor property can be set to any appropriate color.

147. How Can Javascript Be Used To Personalize Or Tailor A Web Site To Fit Individual Users?

JavaScript allows a Web page to perform "if-then" kinds of decisions based on browser version, operating system, user input, and, in more recent browsers, details about the screen size in which the browser is running. While a server CGI program can make some of those same kinds of decisions, not everyone has access to or the expertise to create CGI programs. For example, an experienced CGI programmer can examine information about the browser whenever a request for a page is made; thus a server so equipped might serve up one page for Navigator users and a different page for Internet Explorer users. Beyond browser and operating system version, a CGI program can't know more about the environment. But a JavaScript-enhanced page can instruct the browser to render only certain content based on the browser, operating system, and even the screen size.

Scripting can even go further if the page author desires. For example, the author may include a preference screen that lets the user determine the desired background and text color combination. A script can save this information on the client in a well-regulated local file called a cookie. The next time the user comes to the site, scripts in its pages look to the cookie info and render the page in the color combination selected previously. The server is none the wiser, nor does it have to store any visitor-specific information.

148. Are You Concerned That Older Browsers Don't Support Javascript And Thus Exclude A Set Of Web Users? Individual Users?

Fragmentation of the installed base of browsers will only get worse. By definition, it can never improve unless absolutely everyone on the planet threw away their old browsers and upgraded to the latest gee-whiz versions. But even then, there are plenty of discrepancies between the scriptability of the latest Netscape Navigator and Microsoft Internet Explorer.

The situation makes scripting a challenge, especially for newcomers who may not be aware of the limitations of earlier browsers. A lot of effort in my books and ancillary material goes toward helping scripters know what features work in which browsers and how to either workaround limitations in earlier browsers or raise the compatibility common denominator.

Designing scripts for a Web site requires making some hard decisions about if, when, and how to implement the advantages scripting offers a page to your audience. For public Web sites, I recommend using scripting in an additive way: let sufficient content stand on its own, but let scriptable browser users receive an enhanced experience, preferably with the same HTML document.

149. What Does Isnan Function Do?

Return true if the argument is not a number.

150. What Is Negative Infinity?

It’s a number in JavaScript, derived by dividing negative number by zero.

151. In A Pop-up Browser Window, How Do You Refer To The Main Browser Window That Opened It?

Use window.opener to refer to the main window from pop-ups.

152. What Is The Data Type Of Variables Of In Javascript?

All variables are of object type in JavaScript.

153. Methods Get And Post In Html Forms - What's The Difference?

GET: Parameters are passed in the querystring. Maximum amount of data that can be sent via the GET method is limited to about 2kb.

POST: Parameters are passed in the request body. There is no limit to the amount of data that can be transferred using POST. However, there are limits on the maximum amount of data that can be transferred in one name/value pair.

154. How To Write A Script For "select" Lists Using Javascript

1. To remove an item from a list set it to null.

mySelectObject.options [3] = null;

2. To truncate a list set its length to the maximum size you desire.

mySelectObject.length = 2;

3. To delete all options in a select object set the length to 0.


155. Text From Your Clipboard?


It is true, text you last copied for pasting (copy & paste) can be stolen when you visit web sites using a combination of JavaScript and ASP (or PHP, or CGI) to write your possible sensitive data to a database on another server.