HMTL INTERVIEW

SET -1

1) What is HTML?
HTML is short for HyperText Markup Language, and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that formats it for proper display on pages.
2) What are tags?
Content is placed in between HTML tags 0in order to properly format it. It makes use of the less than symbol (<) and the greater than symbol (>). A slash symbol is also used as a closing tag. For example:

3) Do all HTML tags come in pair?
No, there are single HTML tags that does not need a closing tag. Examples are the <img> tag and <br> tags.
4) What are some of the common lists that can be used when designing a page?
You can insert any or a combination of the following list types:
– ordered list
– unordered list
– definition list
– menu list
– directory list
Each of this list types makes use of a different tag set to compose
5) How do you insert a comment in html?
html interview Questions
Comments in html begins with “<!–“nd ends with “–>”. For example:

6) Do all character entities display properly on all systems?
No, there are some character entities that cannot be displayed when the operating system that the browser is running on does not support the characters. When that happens, these characters are displayed as boxes.
7) What is image map?
Image map lets you link to many different web pages using a single image. You can define shapes in images that you want to make part of an image mapping.
8 ) What is the advantage of collapsing white space?
White spaces are blank sequence of space characters, which is actually treated as a single space character in html. Because the browser collapses multiple space into a single space, you can indent lines of text without worrying about multiple spaces. This enables you to organize the html code into a much more readable format.
9) Can attribute values be set to anything or are there specific values that they accept?
Some attribute values can be set to only predefined values. Other attributes can accept any numerical value that represents the number of pixels for a size.
10) How do you insert a copyright symbol on a browser page?
To insert the copyright symbol, you need to type &copy; or & #169; in an HTML file.
11) How do you create links to sections within the same page?
Links can be created using the <a> tag, with referencing through the use of the number (#) symbol. For example, you can have one line as <a href=”#topmost”>BACK TO TOP</a>, which would result in the words “BACK TO TOP” appearing on the webpage and links to a bookmark named topmost. You then create a separate tag command like <a name=”topmost”> somewhere on the top of the same webpage so that the user will be linked to that spot when he clicked on “BACK TO TOP”.
12) Is there any way to keep list elements straight in an html file?
By using indents, you can keep the list elements straight. If you indent each subnested list in further than the parent list that contains it, you can at a glance determine the various lists and the elements that it contains.
13) If you see a web address on a magazine, to which web page does it point?
Every web page on the web can have a separate web address. Most of these addresses are relative to the top-most web page. The published web address that appears within magazines typically points this top-most page. From this top level page, you can access all other pages within the web site.
14) What is the use of using alternative text in image mapping?
When you use image maps, it can easily become confusing and difficult to determine which hotspots corresponds with which links. Using alternative text lets you put a descriptive text on each hotspot link.
15) Do older html files work on newer browsers?
Yes, older html files are compliant to the HTML standard. Most older files work on the newer browsers, though some features may not work.
16) Does a hyperlink apply to text only?
No, hyperlinks can be used on text as well as images. That means you can convert an image into a link that will allow user to link to another page when clicked. Just surround the image within the <a href=” “>…</a> tag combinations.
17) If the user’s operating system does not support the needed character, how can the symbol be represented?
In cases wherein their operating system does not support a particular character, it is still possible to display that character by showing it as an image instead.
18) How do you change the number type in the middle of a list?
The <li> tag includes two attributes – type and value. The type attribute can be used to change the numbering type for any list item. The value attribute can change the number index.
19) What are style sheets?
Style sheets enable you to build consistent, transportable, and well-defined style templates. These templates can be linked to several different web pages, making it easy to maintain and change the look and feel of all the web pages within a site.
20) What bullet types are available?
With ordered lists, you can select to use a number of different list types including alphabetical and Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.
21) How do you create multicolored text in a webpage?
To create text with different colors, use the <font color=”color”>…</font> tags for every character that you want to apply a color. You can use this tag combination as many times as needed, surrounding a single character or an entire word.
22) Why are there both numerical and named character entity values?
The numerical values are taken from the ASCII values for the various characters, but these can be difficult to remember. Because of this, named character entity values were created to make it easier for web page designers to use.
23) Write a HTML table tag sequence that outputs the following:
50 pcs 100 500
10 pcs 5 50
Answer:
24) What is the advantage of grouping several checkboxes together?
Although checkboxes don’t affect one another, grouping checkboxes together helps to organize them. Checkbox buttons can have their own name and do not need to belong to a group. A single web page can have many different groups of checkboxes.
25) What will happen if you overlap sets of tags?

If two sets of html tags are overlapped, only the first tag will be recognized. You will recognize this problem when the text does not display properly on the browser screen.
26) What are applets?
Applets are small programs that can be embedded within web pages to perform some specific functionality, such as computations, animations, and information processing. Applets are written using the Java language.
27) What if there is no text between the tags or if a text was omitted by mistake? Will it affect the display of the html file?
If there is no text between the tags, then there is nothing to format, so no formatting will appear. Some tags, especially tags without a closing tag like the <img> tag, do not require any text between them.
28) Is it possible to set specific colors for table borders?
You can specify a border color using style sheets, but the colors for a table that does not use style sheets will be the same as the text color.
29) How do you create a link that will connect to another web page when clicked?
To create hyperlinks, or links that connect to another web page, use the href tag. The general format for this is: <a href=”site”>text</a>
Replace “site” with the actual page url that is supposed to be linked to when the text is clicked.
30) What other ways can be used to align images and wrap text?
Tables can be used to position text and images. Another useful way to wrap text around an image is to use style sheets.
31) Can a single text link point to two different web pages?
No. The <a> tag can accept only a single href attribute, and it can point to only a single web page.
32) What is the difference between the directory and menu lists and the unordered list?
The key differences is that the directory and menu lists do not include attributes for changing the bullet style.
33) Can you change the color of bullets?
The bullet color is always the same as that of the first character in the list litem. If you surround the <li> and the first character with a set of <font> tags with the color attribute set, the bullet color and the first character will be a different color from the text.
34) What are the limits of the text field size?
The default size for a text field is around 13 characters, but if you include the size attribute, you can set the size value to be as low as 1. The maximum size value will be determined by the browser width. If the size attribute is set to 0, the size will be set to the default size of 13 characters.
35) Do <th> tags always need to come at the start of a row or column?
Any <tr> tag can be changed to a <th> tag. This causes the text contained within the <th> tag to be displayed as bold in the browser. Although <th> tags are mainly used for headings, they do not need to be used exclusively for headings.
36) What is the relationship between the border and rule attributes?
Default cell borders, with a thickness of 1 pixel, are automatically added between cells if the border attribute is set to a nonzero value. Likewise, If the border attribute is not included, a default 1-pixel border appears if the rules attribute is added to the <table> tag.
37) What is a marquee?
A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the <marquee> and </marquee> tags.
38) How do you create a text on a webpage that will allow you to send an email when clicked?
To change a text into a clickable link to send email, use the mailto command within the href tag. The format is as follows:

39) Are <br> tags the only way to separate sections of text?
No. The <br> tag is only one way to separate lines of text. Other tags, like the <p> tag and <blockquote> tag, also separate sections of text.
40) Are there instances where text will appear outside of the browser?
By default, the text is wrapped to appear within the browser window. However, if the text is part of a table cell with a defined width, the text could extend beyond the browser window.
41) How are active links different from normal links?
The default color for normal and active links is blue. Some browsers recognize an active link when the mouse cursor is placed over that link; others recognize active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.
42) Do style sheets limit the number of new style definitions that can be included within the brackets?
Style sheets do not limit the number of style definitions that can be included within the brackets for a given selector. Every new style definition, however, must be separated from the others by a semicolon symbol.
43) Can I specify fractional weight values such as 670 or 973 for font weight?
Implementation largely depends on the browser, but the standard does not support fractional weight values. Acceptable values must end with two zeroes.
44) What is the hierarchy that is being followed when it comes to style sheets?
If a single selector includes three different style definitions, the definition that is closest to the actual tag takes precedence. Inline style takes priority over embedded style sheets, which takes priority over external style sheets.
45) Can several selectors with class names be grouped together?
You can define several selectors with the same style definition by separating them with commas. This same technique also works for selectors with class names.
46) What happens if you open the external CSS file in a browser?
If you try to open the external CSS file in a browser, the browser cannot open the file, because the file has a different extension. The only way to use an external CSS file is to reference it using <link/> tag within another html document.
47) How do you make a picture into a background image of a web page?
To do this, place a tag code after the </head> tag as follows:
Replace image.gif with the name of your image file. This will take the picture and make it the background image of your web page.
48) What happens if the list-style-type property is used on a non-list element like a paragraph?
If the list-style-type property is used on a non-list element like a paragraph, the property will be ignored and have no effect on the paragraph.
49) When is it appropriate to use frames?
Frames can make navigating a site much easier. If the main links to the site are located in a frame that appears at the top or along the edge of the browser, the content for those links can be displayed in the remainder of the browser window.
50) What happens if the number of values in the rows or cols attribute doesn’t add up to 100 percent?
The browser sizes the frames relative to the total sum of the values. If the cols attribute is set to 100%, 200%, the browser displays two vertical frames with the second being twice as big as the first.



SET -2

What is the relationship between SGML,HTML , XML and XHTML?

SGML (Standard generalized markup language) is a standard which tells how to specify document markup. It’s only a Meta language which describes how a document markup should be. HTML is a markup language which is described using SGML.
So by SGML they created DTD which the HTML refers and needs to adhere to the same. So you will always find “DOCTYPE” attribute at the top of HTML page which defines which DTD is used for parsing purpose.
<!--!doctype-->
Now parsing SGML was a pain so they created XML to make things better. XML uses SGML. For example in SGML you have to start and end tags but in XML you can have closing tags which close automatically (“”).
XHTML was created from XML which was used in HTML 4.0. So for example in SGML derived HTML “
” is not valid but in XHTML it’s valid. You can refer XML DTD as shown in the below code snippet.
<!--!doctype--><!--!doctype-->
HTML 5 is a new standard for HTML whose main target is to deliver everything without need to any additional plugins like flash, Silverlight etc. It has everything from animations, videos, rich GUI etc.
HTML5 is cooperation output between World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).

If I do not put <! DOCTYPE html> will HTML 5 work?

No, browser will not be able to identify that it’s a HTML document and HTML 5 tags will not function properly.

Which browsers support HTML 5?

Almost all browsers i.e. Safari, Chrome, Firefox, Opera, Internet Explorer support HTML 5.

How is the page structure of HTML 5 different from HTML 4 or previous HTML?

A typical web page has headers, footers, navigation, central area and side bars. Now if we want to represent the same in HTML 4 with proper names to the HTML section we would probably use a DIV tag.
But in HTML 5 they have made it more clear by creating element names for those sections which makes your HTML more readable.


Below are more details of the HTML 5 elements which form the page structure.
  • <header>: Represents header data of HTML.
  • <footer>: Footer section of the page.
  • <article>: Self-contained content.
  • <section>: Used inside article to define sections or group content in to sections.

What is datalist in HTML 5?

Datalist element in HTML 5 helps to provide autocomplete feature in a textbox as shown below.
Below is the HTML code for DataList feature:-
<input list="Country">
<datalist id="Country">
<option value="India">
<option value="Italy">
<option value="Iran">
<option value="Israel">
<option value="Indonesia">
</datalist> 

What are the different new form element types in HTML 5?

There are 10 important new form elements introduced in HTML 5:-
  1. Color.
  2. Date
  3. Datetime-local
  4. Email
  5. Time
  6. Url
  7. Range
  8. Telephone
  9. Number
  10. Search
Let’s understand these elements step by step.
If you want to show color picker dialog box.
<input type="color" name="favcolor">  

If you want to show calendar dialog box.
<input type="date" name="bday">  
If you want to show calendar with local time.
<input type="datetime-local" name="bdaytime">  
If you want to create a HTML text with email validation we can set the type as “email”.
<input type="email" name="email"> 
For URL validation set the type as “url” as shown in the below HTML code.
<input type="url" name="sitename">  
For URL validation set the type as “url” as shown in the below HTML code.
If you want to display textbox with number range you can set type to number.
<input type="number" name="quantity" min="1" max="5">  
If you want to display a range control you can use type as range.
<input type="range" min="0" max="10" step="2" value="6">
Want to make text box as search engine box.
<input type="search" name="googleengine">  
What to only take time input.
<input type="time" name="usr_time">  
If you want to make text box to accept telephone numbers.
<input type="tel" name="mytel">  

What is output element in HTML 5?

Output element is needed when you need calculation from two inputs to be summarized in to a label. For instance you have two textboxes( see the below figure) and you want to add numbers from these textboxes and send them to a label.
Below goes the code of how to use output element with HTML 5.
<form onsubmit="return false"  &ouml;ninput="o.value = parseInt(a.value) + parseInt(b.value)">
<input name="a" type="number"> +
<input name="b" type="number"> =
<output name="o" />
</form>
You can also replace “parseInt” with “valueAsNumber” for simplicity. You can also use “for” in the output element for more readability.
<output name="o" for="a b"></output>  

What is SVG?

SVG stands for scalable vector graphics. It’s a text based graphic language which draws images using text, lines, dots etc. This makes it lightweight and renders faster.

Can we see a simple example of SVG using HTML 5?

Let’s say we want to display the below simple line using HTML 5 SVG.
Below is how the code of HTML 5. You can see the SVG tag which encloses the polygon tag for displaying the star image.
<svg id="svgelem" height="[object SVGAnimatedLength]" xmlns="http://www.w3.org/2000/svg">
<line style="stroke: rgb(255, 0, 0); stroke-width: 2px;" y2="[object SVGAnimatedLength]" x2="[object SVGAnimatedLength]" y1="[object SVGAnimatedLength]" x1="[object SVGAnimatedLength]">
</line>

What is canvas in HTML 5?

Canvas is an HTML area on which you can draw graphics.

<canvas height=""500"" id=""mycanvas"" solid=""style=""border:1px" width=""600""></canvas>
Get access to canvas area
To draw on the canvas area we need to first get reference of the context section. Below is the code for canvas section.
var c=document.getElementById("mycanvas");
var ctx=c.getContext("2d"); 
Draw the graphic
Now once you have access to the context object we can start drawing on the context. So first call the “move” method and start from a point , use line method and draw the line and then apply stroke over it.
<a name="WhatisthedifferencebetweenCanvasandSVGgraphics">What is the difference between Canvas and SVG graphics? </a>
Note: - If you see the previous two questions both canvas and SVG can draw graphics on the browser. So in this question interviewer wants to know when will you use what.

SVG
Canvas
Here’s it’s like draw and remember. In other words any shape drawn by using SVG can be remembered and manipulated and browser can render it again.Canvas is like draw and forget. Once something is drawn you cannot access that pixel and manipulate it.
SVG is good for creating graphics like CAD software’s where once something is drawn the user wants to manipulate it.Canvas is good for draw and forget scenarios like animation and games.
This is slow as it needs to remember the co-ordinates for later manipulations.This is faster as there is no intention of remembering things later.
We can have event handler associated with the drawing object.Here we cannot associate event handlers with drawing objects as we do not have reference of them.
Resolution independent.Resolution dependent.

How to draw rectangle using Canvas and SVG using HTML 5?

HTML 5 code Rectangle code using SVG.
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect style="fill: rgb(0, 0, 255); stroke-width: 1px; stroke: rgb(0, 0, 0);" height="[object SVGAnimatedLength]" width="[object SVGAnimatedLength]">
</rect>
HTML 5 Rectangle code using canvas.
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.rect(20,20,150,100);
ctx.stroke();
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <circle fill="red" stroke-width="2" stroke="black" r="[object SVGAnimatedLength]" cy="[object SVGAnimatedLength]" cx="[object SVGAnimatedLength]">

var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;

context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'green';
context.fill();
context.lineWidth = 5;
context.strokeStyle = '#003300';
context.stroke();

<!DOCTYPE html>
<html>
<body  &ouml;nload="DrawMe();">
<svg height="[object SVGAnimatedLength]" width="[object SVGAnimatedLength]">
<circle id="circle1" cx="[object SVGAnimatedLength]" cy="[object SVGAnimatedLength]" r="[object SVGAnimatedLength]" style="stroke: none; fill: rgb(255, 0, 0);">

</body>
<script>

 var timerFunction = setInterval(DrawMe, 20);
alert("ddd");

function DrawMe()
{
var circle = document.getElementById("circle1");
var x = circle.getAttribute("cx");
var newX = 2 + parseInt(x);
if(newX > 500) 
{
            newX = 20;
}
        circle.setAttribute("cx", newX);

}
</script>
</html></circle>

What are selectors in CSS?

Selectors help to select an element to which you want to apply a style. For example below is a simple style called as ‘intro” which applies red color to background of a HTML element.
<style>
.intro
{
background-color:red;
}
</style> 
To apply the above “intro” style to div we can use the “class” selector as shown in the below figure.
<div class="intro">
<p>My name is Shivprasad koirala.</p>
<p>I write interview questions.</p>
</div> 

How can you apply CSS style using ID value?

So let’s say you have a HTML paragraph tag with id “mytext” as shown in the below snippet.
<p id="mytext">This is HTML interview questions.</p> 
You can create a style using “#” selector with the “id” name and apply the CSS value to the paragraph tag. So to apply style to “mytext” element we can use “#mytext” as shown in the below CSS code.
<style>
#mytext
{
background-color:yellow;
}
</style> 
Quick revision of some important selectors.
Set all paragraph tags back ground color to yellow.
P,h1
{ 
background-color:yellow;
} 
Sets all paragraph tags inside div tag to yellow background.
div p
{ 
background-color:yellow;
} 
Sets all paragraph tags following div tags to yellow background.
div+p
{ 
background-color:yellow;
} 
Sets all attribute with “target” to yellow background.
a[target]
{ 
background-color:yellow;
}

<a href="http://www.questpond.com">ASP.NET interview questions</a>
Set all elements to yellow background when control gets focus.
input:focus
{ 
background-color:yellow;
} 
Set hyperlinks according to action on links.
a:link    {color:green;}
a:visited {color:green;}
a:hover   {color:red;}
a:active  {color:yellow;} 

What is the use of column layout in CSS?

CSS column layout helps you to divide your text in to columns. For example consider the below magazine news which is one big text but we need to divide the same in to 3 columns with a border in between. That’s where HTML 5 column layout comes to help.

To implement column layout we need to specify the following:-
  • How many columns we want to divide the text in to ?
To specify number of columns we need to us column-count. “webkit” and “moz-column” are needed for chrome and firefox respectively.
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3; 
  • How much gap we want to give between those columns ?
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:20px; 
  • Do you want to draw a line between those columns , if yes how much thick ?
-moz-column-rule:4px outset #ff00ff; /* Firefox */
-webkit-column-rule:4px outset #ff00ff; /* Safari and Chrome */
column-rule:6px outset #ff00ff; 
Below is the complete code for the same.
<style>
.magazine
{
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3;

-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:20px;

-moz-column-rule:4px outset #ff00ff; /* Firefox */
-webkit-column-rule:4px outset #ff00ff; /* Safari and Chrome */
column-rule:6px outset #ff00ff;
}
</style> 
You can then apply the style to the text by using the class attribute.
<div class="magazine">

Your text goes here which you want to divide in to 3 columns.

</div> 

Can you explain CSS box model?

CSS box model is a rectangular space around a HTML element which defines border, padding and margin.
Border: - This defines the maximum area in which the element will be contained. We can make the border visible, invisible, define height and width etc.
Padding: - This defines the spacing between border and element.
Margin: - This defines the spacing between border and any neighboring elements.

For instance below is a simple CSS code which defines a box with border , padding and margin values.
.box {
    width: 200px;
    border: 10px solid #99c;
    padding: 20px;
    margin: 50px;
} 
Now if we apply the above CSS to a DIV tag as shown in the below code , your output would be as shown in the figure below. I have created two test “Some text” and “Some other text” so that we can see how margin property functions.
<div align="middle" class="box">
Some text
</div>

Some other text 

Can you explain some text effects in CSS 3?

Here the interviewer is expecting you to answer one of two text effects by CSS.Below are two effects which are worth noting.
Shadow text effect
.specialtext
{
text-shadow: 5px 5px 5px #FF0000;
} 

Word wrap effect
<style>
.breakword
{word-wrap:break-word;}
</style> 


What are web workers and why do we need them ?

Consider the below heavy for loop code which runs above million times.
function  SomeHeavyFunction()
{
for (i = 0; i < 10000000000000; i++)
{
x = i + x;
}
} 
Let’s say the above for loop code is executed on a HTML button click. Now this method execution is synchronous. In other words the complete browser will wait until the for loop completes.
<input type="button" onclick="SomeHeavyFunction();" />  
This can further lead to browser getting freezed and unresponsive with an error message as shown in the screen below.
So if we can move this heavy for loop in a JavaScript file and run it asynchronously that means the browser does need to wait for the loop then we can have a more responsive browser. That’s what web worker are for.
Web worker helps to execute JavaScript file asynchronously.

What is local storage concept in HTML 5?

Many times we would like to store information about the user locally in the computer. For example let’s say user has half-filled a long form and suddenly the internet connection breaks off. So the user would like you to store this information locally and when the internet comes back.He would like to get that information and send it to the server for storage.
Modern browsers have storage called as “Local storage” in which you can store this information.

How can we add and remove data from local storage?

Data is added to local storage using “key” and “value”. Below sample code shows country data “India” added with key value “Key001”.
localStorage.setItem(&ldquo;Key001&rdquo;,&rdquo;India&rdquo;);  
To retrieve data from local storage we need to use “getItem” providing the key name.
var country = localStorage.getItem(&ldquo;Key001&rdquo;); 
You can also store JavaScript object’s in the local storage using the below code.
var country = {};
country.name = &ldquo;India&rdquo;;
country.code = &ldquo;I001&rdquo;;
localStorage.setItem(&ldquo;I001&rdquo;, country);
var country1 = localStorage.getItem(&ldquo;I001&rdquo;); 
If you want to store in JSON format you can use “JSON.stringify” function as shown in the below code.
localStorage.setItem(&ldquo;I001&rdquo;,JSON.stringify(country));  

What is the lifetime of local storage?

Local storage does not have a life time it will stay until either the user clear it from the browser or you remove it using JavaScript code.

What is the difference between local storage and cookies?

CookiesLocal storage
Client side / Server side.Data accessible both at client side and server side. Cookie data is sent to the server side with every request.Data is accessible only at the local browser side. Server cannot access local storage until deliberately sent to the server via POST or GET.
Size4095 bytes per cookie.5 MB per domain.
ExpirationCookies have expiration attached to it. So after that expiration the cookie and the cookie data get’s deleted.There is no expiration data. Either the end user needs to delete it from the browser or programmatically using JavaScript we need to remove the same.

What is WebSQL?

WebSQL is a structured relational database at the client browser side. It’s a local RDBMS inside the browser on which you can fire SQL queries.

Is WebSQL a part of HTML 5 specification?

No, many people label it as HTML 5 but it’s not part of HTML 5 specification. The specification is based around SQLite.

So how can we use WebSQL?

The first step we need to do is open the database by using “OpenDatabase” function as shown below. The first argument is the name of the database, the next is the version, then a simple textual title and finally the size of the database.
var db=openDatabase('dbCustomer','1.0','Customer app&rsquo;, 2 * 1024 * 1024); 
To execute SQL we then need to use “transaction” function and call “executeSql” function to fire SQL.
db.transaction(function (tx) 
{
tx.executeSql('CREATE TABLE IF NOT EXISTS tblCust(id unique, customername)');
tx.executeSql('INSERT INTO tblcust (id, customername) VALUES(1, "shiv")');
tx.executeSql('INSERT INTO tblcust (id, customername) VALUES (2, "raju")');
} 
In case you are firing “select” query you will get data is “results” collection which we can loop and display in the HTML UI.
db.transaction(function (tx) 
{
  tx.executeSql('SELECT * FROM tblcust', [], function (tx, results) {
   for (i = 0; i < len; i++)
{
     msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
     document.querySelector('#customer).innerHTML +=  msg;
}
 }, null);
}); 

1.0 CACHE : Login.aspx
  • All manifest file starts with CACHE MANIFEST statement.
  • #( hash tag) helps to provide the version of the cache file.
  • CACHE command specifies which files needs to be cached.
  • The content type of the manifest file should be “text/cache-manifest”.
Below is how cache manifest has been provided using ASP.NET C#.
Response.ContentType = "text/cache-manifest";
Response.Write("CACHE MANIFEST \n");
Response.Write("# 2012-02-21 v1.0.0 \n");
Response.Write("CACHE : \n");
Response.Write("Login.aspx \n");
Response.Flush();
Response.End(); 
One the cache manifest file is created the next thing is to provide the link of the manifest file in the HTML page as shown below.
<html manifest="cache.aspx"> 
When the above file runs first time it gets added in the browser application cache and in case server goes down the page is served from the application cache.

What is fallback in Application cache?

<a name="WhatisfallbackinApplicati>FALLBACK:
/home/ /homeoffline.html </a>

No comments:

Post a Comment