Question 1. What Is
Html?
Answer :
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.
Question 2. What Is A
Tag?
Answer :
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.
Question 3. What Is The
Simplest Html Page?
Answer :
HTML Code:
<HTML>
<HEAD>
<TITLE>This is my page title! </TITLE>
</HEAD>
<BODY>
This is my message to the world!
</BODY>
</HTML>
Browser Display:
This is my message to the world!
Question 4. How Do I
Create Frames? What Is A Frameset?
Answer :
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.
Question 5. How Can I
Include Comments In Html?
Answer :
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.
Question 6. What Is A
Hypertext Link?
Answer :
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.
Question 7. What Is
Everyone Using To Write Html?
Answer :
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.
Question 8. What Is A
Doctype? Which One Do I Use?
Answer :
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.
Question 9. Can I Nest
Tables Within Tables?
Answer :
Yes, a table can be
embedded inside a cell in another table. Here's a simple example:
<table>
<tr>
<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
<table>
<tr>
<td>this is the first cell of the inner table</td>
<td>this is the second cell of the inner table</td>
</tr>
</table>
</td>
</tr>
</table>
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.
Question 10. How Do I
Align A Table To The Right (or Left)?
Answer :
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 align="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.
Question 11. How Can I
Use Tables To Structure Forms?
Answer :
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.
<FORM ACTION="[URL]">
<TABLE BORDER="0">
<TR>
<TH>Account:</TH>
<TD><INPUT TYPE="text"
NAME="account"></TD>
</TR>
<TR>
<TH>Password:</TH>
<TD><INPUT TYPE="password"
NAME="password"></TD>
</TR>
<TR>
<TD> </TD>
<TD><INPUT TYPE="submit" NAME="Log
On"></TD>
</TR>
</TABLE>
</FORM>
Question 12. How Do I
Center A Table?
Answer :
In your HTML, use
<div class="center">
<table>...</table>
</div>
In your CSS, use
div.center {
text-align: center;
}
div.center table {
margin-left: auto;
margin-right: auto;
text-align: left;
}
Question 13. How Do I
Use Forms?
Answer :
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.
Question 14. How Can I
Check For Errors?
Answer :
HTML validators 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 validators 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 validators (e.g. the "CSE HTML
Validator") are really linters/checkers. They are still useful, but they
should not be confused with real HTML validators.
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.
Question 15. Do I Have
To Memorize A Bunch Of Tags?
Answer :
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.
Question 16. How Do I
Make A Form So It Can Be Submitted By Hitting Enter?
Answer :
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.
Question 17. How Do I
Set The Focus To The First Form Field?
Answer :
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="myform" name="myform" action=...>
<input type="text" id="myinput" name="myinput"
...>
</form>
<script type="text/javascript">
document.myform.myinput.focus();
</script>
A similar approach uses <body onload=...> to set the focus, but some
browsers seem to process the ONLOAD event before the entire document (i.e., the
part with the form) has been loaded.
Question 18. How Can I
Eliminate The Extra Space After A Tag?
Answer :
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 ; }
Question 19. How Can I
Show Html Examples Without Them Being Interpreted As Part Of My Document?
Answer :
Within the HTML example,
first replace the "&" character with "&"
everywhere it occurs. Then replace the "<" character with
"<" and the ">" character with ">"
in the same way.
Note that it may be
appropriate to use the CODE and/or PRE elements when displaying HTML examples.
Question 20. How Do I
Eliminate The Blue Border Around Linked Images?
Answer :
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.
Question 21. How Can I
Specify Colors?
Answer :
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.
Question 22. How Can I
Allow File Uploads To My Web Site?
Answer :
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!
</form>
Not all browsers support form-based file upload, so try to give alternatives
where possible.
The Perl CGI.pm module supports file upload. The most recent versions of the
cgi-lib.pl 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.
Question 23. How Can I
Require That Fields Be Filled In, Or Filled In Correctly?
Answer :
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 CGI.pm 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.
Question 24. How Do I
Change The Title Of A Framed Document?
Answer :
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).
Question 25. How Do I
Link An Image To Something?
Answer :
Just use the image as
the link content, like this:
<a href=...><img src=... alt=...></a>
Question 26. How Do I
Specify A Specific Combination Of Frames Instead Of The Default Document?
Answer :
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.
Question 27. How Do I
Create A Link?
Answer :
Use an anchor element.
The HREF attribute specifies the URL of the document that you want to link to.
The following example links the text "Web Authoring FAQ" to
<URL:http://www.htmlhelp.com/faq/html/>:
<A HREF="http://www.yoursite.com/faq/html/">Web Authoring
FAQ</A>
Question 28. How Do I
Create A Link That Opens A New Window?
Answer :
<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.
Question 29. How Do I
Create A Button Which Acts Like A Link?
Answer :
This is best done with a
small form:
<FORM ACTION="[URL]" METHOD=GET>
<INPUT TYPE=submit VALUE="Text on button">
</FORM>
If you want to line up buttons next to each other, you will have to put them in
a one-row table, with each button in a separate cell.
Question 30. How Can I
Make A Form With Custom Buttons?
Answer :
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.
Question 31. How Do I
Specify Page Breaks In Html?
Answer :
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.
Question 32. How Do I
Remove The Border Around Frames?
Answer :
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.
Question 33. Why Aren't
My Frames The Exact Size I Specified?
Answer :
Older versions of
Netscape Navigator seems 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.
Question 34. How Can I
Specify Background Images?
Answer :
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.
Question 35. How Can I
Copy Something From A Webpage To My Webpage?
Answer :
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.
Question 36. Is It
Possible To Make The Html Source Not Viewable?
Answer :
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.
Question 37. Why Doesn't
My Title Show Up When I Click "check It Out"?
Answer :
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.
Question 38. What Is The
Difference Between The Html Form Methods Get And Post?
Answer :
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 - post_args
* GET - httpargs
Question 39. How Do I
Put Sounds For Older Versions Of Internet Explorer?
Answer :
For older versions of
Internet Explorer, this technique was used <BG
SOUND="sound.ext">.
Question 40. Can I Use
Any Html In The Box?
Answer :
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.
Question 41. How To
Transferring User To New Web Page Automatically?
Answer :
You will need to use the
below meta tag.
<META HTTP-EQUIV="Refresh" CONTENT="2";
URL="http://www.yourname.com">
Placing the above tag in your <HEAD></HEAD> will load yousite.com
in 2 seconds.
Changing the 2 value on CONTENT="2" to another value will increase or
decrease the delay until loading the new page.
Question 42. How Do I
Keep People From Stealing My Source Code And/or Images?
Answer :
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.
Question 43. The Colors
On My Page Look Different When Viewed On A Mac And A Pc.
Answer :
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.
Question 44. How Do You
Create Tabs Or Indents In Web Pages?
Answer :
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.
Question 45. My Page
Looks Good On One Browser, But Not On Another.
Answer :
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.
Question 46. When I Try
To Upload My Site, All My Images Are X's. How Do I Get Them To Load Correctly?
Answer :
They are a few reasons
that this could happen. The most common are:
1. 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.
2. You've forgotten to upload the graphic files. Double-Check.
3. You've incorrectly linked to the images. When you are starting out, try just
using the file name in the <img> tag. If you have cat.jpg, use
img src="cat.jpg">.
4. 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.
5. If all of the above fail, re-upload the image in BINARY mode. You may have
accidentally uploaded the image in ASCII mode.
Question 47. Why Does
The Browser Show My Plain Html Source?
Answer :
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.
Question 48. How Can I
Display An Image On My Page?
Answer :
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">
Question 49. Why Do My
Links Open New Windows Rather Than Update An Existing Frame?
Answer :
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.
Question 50. How Do I
Make A Frame With A Vertical Scrollbar But Without A Horizontal Scrollbar?
Answer :
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.
Question 51. What Are
The Attributes That Make Up A Dhtml?
Answer :
DHTML is called as
Dynamic HTML. This is used to increase the interactive ability and the visual
effect of the web pages which is loaded in the browser. The main technologies
that are used in DHTML are namely:
* HTML
* JavaScript
* CSS which is also called as Cascading Style Sheet
* DOM also called as Document Object Model
Question 52. What Is
Meant By Iframe ?
Answer :
iframe is used for
creating an inline or floating frame. As most of know frames are mainly used to
structure the page or for placing a menu bar on the side and so on. But iframe
is used in a different context. That is in other words iframe is used to embed
or insert content on a page of padding. This is done for several reasons. Say
the content may be large enough that the user may wish to place it separately
and scroll through it.
Question 53. How To
Place A Background For A Single Table Cell?
Answer :
You can put a background
for a single table cell in two ways namely: Either by using HTML Using CSS
Question 54. What Are
Differences Between Div And Span?
Answer :
DIV is used to select a
block of text so that one can apply styles to it. SPAN is used to select inline
text and let users to apply styles to it. The main difference between DIV and
SPAN is SPAN does not do formatting by itself. Also the DIV tag is used as a
paragraph break as it creates a logical division of the document in which it is
applied. This is in contrast to the SPAN as SPAN simply dos the functionality
of applying the style and alignment whatever was specified in it. DIV has ALIGN
attribute in it which is not present in case of SPAN. Thus DIV is used in cases
where one wants to apply styles to a block of text. But there may be situations
in which there might not be clear well structured block of text to work with.
In those cases one can opt to apply SPAN which is used to apply styles inline.
That is in other words DIV is generally used for block of text and SPAN is
generally used for words or sentences.
Question 55. What Are
The Differences Between Cell Spacing And Cell Padding?
Answer :
Cell padding is used for
formatting purpose which is used to specify the space needed between the edges
of the cells and also in the cell contents. Cell spacing is one also used f
formatting but there is a major difference between cell padding and cell
spacing. It is as follows: Cell padding is used to set extra space which is
used to separate cell walls from their contents. But in contrast cell spacing
is used to set space between cells.
Question 56. How Do I
Add Scrolling Text To My Page?
Answer :
Add a Tag of marquee
Question 57. How Do I
Close A Browser Window With Html Code?
Answer :
Use the below code
example. < type="button" value="Close this window" onclick="self.close()">
Question 58. How Do I Do
Multiple Colors Of Text?
Answer :
To do the multicolor
text adjust the color of your font tag as:
< font color="blue">blue
Question 59. What Are
Style Sheets?
Answer :
Style Sheets are
templates, very similar to templates in desktop publishing applications,
containing a collection of rules declared to various selectors (elements).
Question 60. What Are
Cascading Style Sheets?
Answer :
A Cascading Style Sheet
(CSS) is a list of statements (also known as rules) that can assign various
rendering properties to HTML elements. Style rules can be specified for a
single element occurrence, multiple elements, an entire document, or even
multiple documents at once. It is possible to specify many different rules for
an element in different locations using different methods. All these rules are
collected and merged (known as a "cascading" of styles) when the
document is rendered to form a single style rule for each element.
Question 61. What Is
External Style Sheet? How To Link?
Answer :
External Style Sheet is
a template/document/file containing style information which can be linked with
any number of HTML documents. This is a very convenient way of formatting the
entire site as well as restyling it by editing just one file. The file is
linked with HTML documents via the LINK element inside the HEAD element. Files
containing style information must have extension .css, e.g. style.css.
Question 62. Is Css Case
Sensitive?
Answer :
Cascading Style Sheets
(CSS) is not case sensitive. However, font families, URLs to images, and other
direct references with the style sheet may be.
The trick is that if you
write a document using an XML declaration and an XHTML doctype, then the CSS
class names will be case sensitive for some browsers.
It is a good idea to
avoid naming classes where the only difference is the case, for example:
div.myclass { ...}
div.myClass { ... }
If the DOCTYPE or XML
declaration is ever removed from your pages, even by mistake, the last instance
of the style will be used, regardless of case.
Question 63. What Is Css
Rule 'ruleset'?
Answer :
There are two types of
CSS rules: ruleset and at-rule. Ruleset identifies selector or selectors and
declares style which is to be attached to that selector or selectors. For example
P {text-indent: 10pt} is a CSS rule. CSS rulesets consist of two parts:
selector, e.g. P and declaration, e.g. {text-indent: 10pt}.
P {text-indent: 10pt} -
CSS rule (ruleset)
{text-indent: 10pt} - CSS declaration
text-indent - CSS property
10pt - CSS value
Question 64. 'fixed'
Background?
Answer :
There is the possibility
to use the HTML tag bgproperties="fixed", but that is IE proprietary,
and dependent upon the 'background' attribute (deprecated in HTML4).
With CSS, you can declare the background like:
BODY {
font-family : "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background-image: url(images/yourimage.gif);
background-repeat: no-repeat; /*no-tiling background*/
background-position: center;
background-attachment: fixed;
background-color: #hexcolor;
color : #hexcolor;
margin: 10px;
}
that shows a background-image in the center of the <BODY> element,
non-scrolling and non-repeating - in IE or NN6. NN 4.xx gets the
non-repeat-part right, but stuffs the picture in the upper left corner and scrolls
...
Question 65. What Is
Embedded Style? How To Link?
Answer :
Embedded style is the
style attached to one specific document. The style information is specified as
a content of the STYLE element inside the HEAD element and will apply to the
entire document.
<HEAD>
<STYLE TYPE="text/css">
<!--
P {text-indent: 10pt}
-->
</STYLE>
</HEAD>
Note: The styling rules are written as a HTML comment, that is, between <!--
and --> to hide the content in browsers without CSS support which would
otherwise be displayed.
Question 66. How Do I
Have A Background Image That Isn't Tiled?
Answer :
Specify the
background-repeat property as no-repeat. You can also use the background
property as a shortcut for specifying multiple background-* properties at once.
Here's an example:
BODY {background: #FFF url(watermark.jpg) no-repeat;}
Question 67. Why Do
Style Sheets Exist?
Answer :
SGML (of which HTML is a
derivative) was meant to be a device-independent method for conveying a
document's structural and semantic content (its meaning.) It was never meant to
convey physical formatting information. HTML has crossed this line and now
contains many elements and attributes which specify visual style and formatting
information. One of the main reasons for style sheets is to stop the creation
of new HTML physical formatting constructs and once again separate style
information from document content.
Question 68. What Is
Inline Style? How To Link?
Answer :
Inline style is the
style attached to one specific element. The style is specified directly in the
start tag as a value of the STYLE attribute and will apply exclusively to this
specific element occurrence.
<P STYLE="text-indent: 10pt">Indented paragraph</P>
Question 69. What Is A
Style Sheet?
Answer :
Style sheets are the way
that standards-compliant Web designers define the layout, look-and-feel, and
design of their pages. They are called Cascading Style Sheets or CSS. With
style sheets, a designer can define many aspects of a Web page:
fonts
* colors
* layout
* positioning
* imagery
* accessibility
Style sheets give you a
lot of power to define how your pages will look. And another great thing about
them is that style sheets make it really easy to update your pages when you
want to make a new design. Simply load in a new style sheet onto your pages and
you're done.
Question 70. How Do I
Place Text Over An Image?
Answer :
To place text or image
over an image you use the position property. The below example is supported by
IE 4.0. All you have to do is adapt the units to your need.
<div style="position: relative; width: 200px; height: 100px">
<div style="position: absolute; top: 0; left: 0; width: 200px">
<image>
</div>
<div style="position: absolute; top: 20%; left: 20%; width:
200px">
Text that nicely wraps
</div>
</div>
Question 71. Why Does My
Content Shift To The Left On Some Pages (in Ff)?
Answer :
That'll be the pages
with more content? The ones that have a vertical scrollbar? If you look in IE
there's probably a white space on the right where there would be a scrollbar if
there were enough content to require one. In Firefox, the scrollbar appears
when it's needed and the viewport becomes about 20px smaller, so the content
seems to shift to the left when you move from a page with little content to one
with lots of content. It's not a bug or something that needs to be fixed, but
it does confuse and irritate some developers.
If, for some reason, you'd like Firefox to always have scrollbars - whether
they're needed or not - you can do this :
CSS html {
height:100.1%;
}
Question 72. How Do I
Combine Multiple Sheets Into One?
Answer :
To combine
multiple/partial style sheets into one set the TITLE attribute taking one and
the same value to the LINK element. The combined style will apply as a
preferred style, e.g.:
<LINK REL=Stylesheet HREF="default.css"
TITLE="combined">
<LINK REL=Stylesheet HREF="fonts.css"
TITLE="combined">
<LINK REL=Stylesheet HREF="tables.css"
TITLE="combined">
Question 73. Which Set
Of Definitions, Html Attributes Or Css Properties, Take Precedence?
Answer :
CSS properties take
precedence over HTML attributes. If both are specified, HTML attributes will be
displayed in browsers without CSS support but won't have any effect in browsers
with CSS support.
Question 74. Why Call
The Subtended Angle A "pixel", Instead Of Something Else (e.g.
"subangle")?
Answer :
In most cases, a CSS
pixel will be equal to a device pixel. But, as you point out, the definition of
a CSS pixel will sometimes be different. For example, on a laser printer, one
CSS pixel can be equal to 3x3 device pixels to avoid printing illegibly small
text and images. I don't recall anyone ever proposing another name for it.
Subangle? Personally, I think most people would prefer the pragmatic
"px" to the non-intuitive "sa".
Question 75. Why Was The
Decision Made To Make Padding Apply Outside Of The Width Of A 'box', Rather
Than Inside, Which Would Seem To Make More Sense?
Answer :
It makes sense in some
situations, but not in others. For example, when a child element is set to
width: 100%, I don't think it should cover the padding of its parent. The
box-sizing property in CSS3 addresses this issue. Ideally, the issue should
have been addressed earlier, though.
Question 76. Can Css Be
Used With Other Than Html Documents?
Answer :
Yes. CSS can be used
with any ny structured document format. e.g. XML, however, the method of
linking CSS with other document types has not been decided yet.
Question 77. Can Style
Sheets And Html Stylistic Elements Be Used In The Same Document?
Answer :
Yes. Style Sheets will
be ignored in browsers without CSS-support and HTML stylistic elements used.
Question 78. How Do I
Design For Backward Compatibility Using Style Sheets?
Answer :
Existing HTML style
methods (such as <font SIZE> and <b>) may be easily combined with
style sheet specification methods. Browsers that do not understand style sheets
will use the older HTML formatting methods, and style sheets specifications can
control the appearance of these elements in browsers that support CSS1.
Question 79. Why Use
Style Sheets?
Answer :
Style sheets allow a
much greater degree of layout and display control than has ever been possible
thus far in HTML. The amount of format coding necessary to control display
characteristics can be greatly reduced through the use of external style sheets
which can be used by a group of documents. Also, multiple style sheets can be
integrated from different sources to form a cohesive tapestry of styles for a
document. Style sheets are also backward compatible - They can be mixed with
HTML styling elements and attributes so that older browsers can view content as
intended.
Question 80. What Is Css
Rule 'at-rule'?
Answer :
There are two types of
CSS rules: ruleset and at-rule. At-rule is a rule that applies to the whole
style sheet and not to a specific selector only (like in ruleset). They all
begin with the @ symbol followed by a keyword made up of letters a-z, A-Z,
digits 0-9, dashes and escaped characters, e.g. @import or @font-face.
Question 81. What Is
Selector?
Answer :
CSS selector is
equivalent of HTML element(s). It is a string identifying to which element(s)
the corresponding declaration(s) will apply and as such the link between the
HTML document and the style sheet.
For example in P
{text-indent: 10pt} the selector is P and is called type selector as it matches
all instances of this element type in the document.
in P, UL {text-indent:
10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt}
the selector is .class (see class selector).
Question 82. What Is Css
Declaration?
Answer :
CSS declaration is style
attached to a specific selector. It consists of two parts; property which is
equivalent of HTML attribute, e.g. text-indent: and value which is equivalent
of HTML value, e.g. 10pt. NOTE: properties are always ended with a colon.
Question 83. What Is
'important' Declaration?
Answer :
Important declaration is
a declaration with increased weight. Declaration with increased weight will
override declarations with normal weight. If both reader's and author's style
sheet contain statements with important declarations the author's declaration
will override the reader's.
BODY {background: white ! important; color: black}
In the example above the background property has increased weight while the
color property has normal.
Question 84. What Is
Cascade?
Answer :
Cascade is a method of
defining the weight (importance) of individual styling rules thus allowing
conflicting rules to be sorted out should such rules apply to the same
selector.
Declarations with increased weight take precedence over declaration with normal
weight:
P {color: white ! important} /* increased weight */
P (color: black} /* normal weight */
Question 85. Are Style
Sheets Case Sensitive?
Answer :
No. Style sheets are
case insensitive. Whatever is case insensitive in HTML is also case insensitive
in CSS. However, parts that are not under control of CSS like font family names
and URLs can be case sensitive - IMAGE.gif and image.gif is not the same file.
Question 86. How Do I
Have A Non-tiling (non-repeating) Background Image?
Answer :
With CSS, you can use
the background-repeat property. The background repeat can be included in the
short hand background property, as in this example:
body {
background: white url(example.gif) no-repeat ;
color: black ;
}
Question 87. Styles Not Showing?
Answer :
There are different ways
to apply CSS to a HTML document with a stylesheet, and these different ways can
be combined:
inline (internal)
(Deprecated for XHTML)
* embedded (internal)
* linked (external) and
* @import (external)
Note: An external
stylesheet is a text file that contains only CSS Styles. HTML comments are not
supposed to be in there and can lead to misinterpretation (> is the CSS
"Child" selector!).
Question 88. How Do I
Quote Font Names In Quoted Values Of The Style Attribute?
Answer :
The attribute values can
contain both single quotes and double quotes as long as they come in matching
pairs. If two pair of quotes are required include single quotes in double ones
or vice versa:
<P STYLE="font-family: 'New Times Roman'; font-size: 90%">
<P STYLE='font-family: "New Times Roman"; font-size: 90%'>
It's been reported the latter method doesn't work very well in some browsers,
therefore the first one should be used.
Question 89. What Can Be
Done With Style Sheets That Can Not Be Accomplished With Regular Html?
Answer :
Many of the recent
extensions to HTML have been tentative and somewhat crude attempts to control
document layout. Style sheets go several steps beyond, and introduces complex
border, margin and spacing control to most HTML elements. It also extends the
capabilities introduced by most of the existing HTML browser extensions.
Background colors or images can now be assigned to ANY HTML element instead of
just the BODY element and borders can now be applied to any element instead of
just to tables. For more information on the possible properties in CSS, see the
Index DOT Css Property Index.
Question 90. What Is
Property?
Answer :
Property is a stylistic
parameter (attribute) that can be influenced through CSS, e.g. FONT or WIDTH.
There must always be a corresponing value or values set to each property, e.g.
font: bold or font: bold san-serif.
Question 91. How Do I
Write My Style Sheet So That It Gracefully Cascades With User's Personal Sheet
?
Answer :
You can help with this by
setting properties in recommended places. Style rules that apply to the whole
document should be set in the BODY element -- and only there. In this way, the
user can easily modify document-wide style settings.
Question 92. How Can I
Make A Page Look The Same In E.g. Ns And Msie ?
Answer :
The simple answer is,
you can't, and you shouldn't waste your time trying to make it exactly the
same. Web browsers are allowed, per definition, to interpret a page as they
like, subject to the general rules set down in the HTML and CSS specifications.
As a web author you can not have a prior knowledge of the exact situation
and/or medium that will be used to render your page, and it's almost always
rather counterproductive to try to control that process. There is no necessity
for a well-written page to look the same in different browsers. You may want to
strive to ensure that it looks good in more than one browser, even if the
actual display (in the case of graphical browsers) comes out a bit different.
"Looking good" can be achieved by adopting sensible design and
guidelines, such as not fixing the size or face of your fonts, not fixing the
width of tables, etc… Don't fight the medium; most web users only use one
browser and will never know, or bother to find out, that your page looks
different, or even "better", in any other browser.
Question 93. Is There
Anything That Can't Be Replaced By Style Sheets?
Answer :
Quite a bit actually.
Style sheets only specify information that controls display and rendering
information. Virtual style elements that convey the NATURE of the content can
not be replaced by style sheets, and hyperlinking and multimedia object
insertion is not a part of style sheet functionality at all (although
controlling how those objects appear IS part of style sheets functionality.)
The CSS1 specification has gone out of its way to absorb ALL of the HTML
functionality used in controlling display and layout characteristics. For more
information on the possible properties in CSS, see the Index DOT Css Property
Index.
Rule of Thumb: if an
HTML element or attribute gives cues as to how its contents should be
displayed, then some or all of its functionality has been absorbed by style
sheets.
Question 94. Can I
Include Comments In My Style Sheet?
Answer :
Yes. Comments can be
written anywhere where whitespace is allowed and are treated as white space
themselves. Anything written between /* and */ is treated as a comment (white
space). NOTE: Comments cannot be nested.
Question 95. Which
Characters Can Css-names Contain?
Answer :
The CSS-names; names of
selectors, classes and IDs can contain characters a-z, A-Z, digits 0-9, period,
hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode
character as a numeric code. The names cannot start with a dash or a digit.
(Note: in HTML the value of the CLASS attribute can contain more characters).
Question 96. What
Browsers Support Style Sheets? To What Extent?
Answer :
Microsoft's Internet
Explorer version 3.0 Beta 2 and above supports CSS, as does Netscape
Communicator 4.0 Beta 2 and above and Opera 3.5 and above. Take note that the
early implementations in these browsers did not support ALL of the properties
and syntax described in the full CSS1 specification and beyond. Later versions
have been getting much closer to full CSS1 compliance, but then comes the next
hurdle - CSS2...it was such a big leap over CSS1 that it has taken the browsers
years to come close to supporting a majority of CSS2's features. Mozilla and
Opera's current versions both offer excellent CSS standards compliance. The
Macintosh version of Internet Explorer is said to be very impressive in its CSS
capabilities as well, but PC IE lags behind these implementations. Quite a few
other implementations of CSS now exist in browsers that are not as widely-used
(such as Amaya, Arena and Emacs-W3), but coverage of features in these
documents currently only covers Internet Explorer, NCSA Mosaic, Netscape and
Opera browsers.
Question 97. Why
Shouldn't I Use Fixed Sized Fonts ?
Answer :
Only in very rare
situations we will find users that have a "calibrated" rendering
device that shows fixed font sizes correct. This tells us that we can never
know the real size of a font when it's rendered on the user end. Other people
may find your choice of font size uncomfortable. A surprisingly large number of
people have vision problems and require larger text than the average. Other
people have good eyesight and prefer the advantage of more text on the screen
that a smaller font size allows. What is comfortable to you on your system may
be uncomfortable to someone else. Browsers have a default size for fonts. If a
user finds this inappropriate, they can change it to something they prefer. You
can never assume that your choice is better for them. So, leave the font size
alone for the majority of your text. If you wish to change it in specific
places (say smaller text for a copyright notice at the bottom of page), use
relative units so that the size will stay in relationship to what the user may
have selected already. Remember, if people find your text uncomfortable, they
will not bother struggling with your web site. Very few (if any) web sites are
important enough to the average user to justify fighting with the author's idea
of what is best.
Question 98. What Is Initial
Value?
Answer :
Initial value is a
default value of the property, that is the value given to the root element of
the document tree. All properties have an initial value. If no specific value
is set and/or if a property is not inherited the initial value is used. For
example the background property is not inherited, however, the background of
the parent element shines through because the initial value of background
property is transparent.
<P style="background: red">Hello <strong>World
</strong> </P>
Content of the element P will also have red background
Question 99. How
Frustrating Is It To Write A Specification Knowing That You're At The Browser
Vendors' Mercy?
Answer :
That's part of the game.
I don't think any specification has a birthright to be fully supported by all
browsers. There should be healthy competition between different specifications.
I believe simple, author-friendly specifications will prevail in this
environment.
Microformats are another
way of developing new formats. Instead of having to convince browser vendors to
support your favorite specification, microformats add semantics to HTML through
the CLASS attribute. And style it with CSS.
Question 100. How Far
Can Css Be Taken Beyond The Web Page--that Is, Have Generalized Or Non-web
Specific Features For Such Things As Page Formatting Or Type Setting?
Answer :
Yes, it's possible to
take CSS further in several directions. W3C just published a new Working Draft
which describes features for printing, e.g., footnotes, cross-references, and
even generated indexes.
Another great
opportunity for CSS is Web Applications. Just like documents, applications need
to be styled and CSS is an intrinsic component of AJAX. The "AJAX"
name sounds great.
Question 101. How To
Style Table Cells?
Answer :
Margin, Border and
Padding are difficult to apply to inline elements. Officially, the <TD>
tag is a block level element because it can contain other block level elements
(see Basics - Elements).
If you need to set
special margins, borders, or padding inside a table cell, then use this markup:
<td>
<div class=”data”>
yourtext </div></td> Question 102. How To
Style Forms?
Answer :
Forms and form elements
like SELECT, INPUT etc. can be styled with CSS - partially.
Checkboxes and
Radiobuttons do not yet accept styles, and Netscape 4.xx has certain issues,
but here is a tutorial that explains the application of CSS Styles on Form
Elements.
Question 103. Can I
Attach More Than One Declaration To A Selector?
Answer :
Yes. If more than one
declaration is attached to a selector they must appear in a semi colon
separated list, e.g.;
Selector {declaration1; declaration2}
P {background: white; color: black}
Question 104. What Is
The Percentage Value In 'font-size' Relative To?
Answer :
It is relative to the
parent element's font-size. For example, if the style sheet says:
H1 {font-size: 20pt;}
SUP {font-size: 80%;}
...then a <SUP> inside an <H1> will have a font-size of 80% times
20pt, or 16pt.
Question 105. Must I
Quote Property Values?
Answer :
Generally no. However,
values containing white spaces, e.g. font-family names should be quoted as
white spaces surrounding the font name are ignored and whitespaces inside the
font name are converted to a single space, thus font names made up of more than
one word (e.g.) 'Times New Roman' are interpreted as three different names:
Times, New and Roman.
Question 106. Do Any
Wysiwyg Editors Support The Creation Of Style Sheets? Any Text-based Html
Editors?
Answer :
As support for CSS in
browsers has matured in the last year, both WYSIWYG and Text-based HTML editors
have appeared that allow the creation or the assistance of creating Cascading
Style Sheet syntax. There are now at least two dozen editors supporting CSS
syntax in some form. The W3C maintains an up-to-date list of these WYSIWYG and
text-based editors.
Question 107. Do Url's
Have Quotes Or Not?
Answer :
Double or single quotes
in URLs are optional. The tree following examples are equally valid:
BODY {background: url(pics/wave.png) blue}
BODY {background: url("pics/wave.png") blue}
BODY {background: url('pics/wave.png') blue}
Question 108. Can You
Use Someone Else's Style Sheet Without Permission?
Answer :
This is a somewhat fuzzy
issue. As with HTML tags, style sheet information is given using a special
language syntax. Use of the language is not copyrighted, and the syntax itself
does not convey any content - only rendering information.
It is not a great idea
to reference an external style sheet on someone else's server. Doing this is
like referencing an in-line image from someone else's server in your HTML
document. This can end up overloading a server if too many pages all over the
net reference the same item. It can't hurt to contact the author of a style
sheet, if known, to discuss using the style sheet, but this may not be
possible. In any case, a local copy should be created and used instead of
referencing a remote copy.
Question 109. Document
Style Semantics And Specification Language (dsssl)?
Answer :
Document Style Semantics
and Specification Language is an international standard, an expression
language, a styling language for associating processing (formatting and
transformation) with SGML documents, for example XML.
Question 110. What Is
Extensible Stylesheet Language (xsl)?
Answer :
XSL is a proposed
styling language for formatting XML (eXtensible Markup Language) documents. The
proposal was submitted to the W3C by Microsoft, Inso, and ArborText.
Question 111. Explain In
Brief About The Term Css.
Answer :
A stylesheet language
used to describe the presentation of a document written in a markup language.
Cascading Style Sheets are a big breakthrough in Web design because they allow
developers to control the style and layout of multiple Web pages all at once.
Question 112. What Are
The Various Style Sheets?
Answer :
Inline, external,
imported and embedded are the different types of style sheets.
Question 113. What Are
Style Sheet Properties?
Answer :
CSS Background
CSS Text
CSS Font
CSS Border
CSS Outline
CSS Margin
CSS Padding
CSS List
CSS Table
Question 114. List
Various Font Attributes Used In Style Sheet.
Answer :
font-style
font-variant
font-weight
font-size/line-height
font-family
caption
icon
menu
message-box
small-caption
status-bar
Question 115. Explain
Vbscript In Detail.
Answer :
This is a scripting
language developed by Microsoft and is based loosely on Visual Basic. Its
functionality in a web environment is dependant upon either an ASP engine or
the Windows Scripting Host, and must be used on a Windows hosting platform.
Question 116. What Is
Html5?
Answer :
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.
Question 117. Describe
Any Two New Features Of Html5?
Answer :
HTML 5 comes up with
many new features including video/audio elements for media playback and better
support for local offline storage.
Question 118. What Does
A <hgroup> Tag Do?
Answer :
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.
Question 119. Which
Video Formats Are Used For The Video Element?
Answer :
Ogg, MPEG4, WebM.
Question 119. How Can We
Embed Video In Html5?
Answer :
<video
src="movie.ogg" controls="controls"></video>
Question 120. Which
Video Format Is Supported By Ie?
Answer :
IE supports MPEG4 and
WebM.
Question 121. Name The
Audio Formats Supported In Html5?
Answer :
Ogg Vorbis, MP3, WAV.
Question 122. What Will
The Following Code Do?
<audio Src="song.ogg"
Controls="controls"></audio>
Answer :
It will play the audio
file named song.ogg.
Question 123. How Will
You Define Canvas With Reference To Html5?
Answer :
It is a rectangular
area, where we can control every pixel.
Question 124. Give An
Example Of Adding Canvas In Html5?
Answer :
<canvas
id="myCanvas" width="200"
height="100"></canvas>
Question 125. What Is
The Difference Between Html And Html5 ?
Answer :
HTML5 is nothing more
then upgreaded 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 plugin like Flash player or
other library.
Question 126. What Is
The < !doctype > ? Is It Necessary To Use In Html5 ?
Answer :
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).
Question 127. How Many
New Markup Elements You Know In Html5?
Answer :
Below are the New Markup
Elements added in HTML5
Question 128. What Are
The New Media Elements In Html5? Is Canvas Element Used In Html5?
Answer :
Below are the New Media
Elements have added in HTML5
yes we can use Canvas
element in html5 like below
<canvas>.
Question 129. Do You
Know New Input Type Attribute In Html5?
Answer :
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
datetime A date and/or
time
date A date
month A month
week A week
time The input value is of type time
datetime-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
Question 129. How To Add
Video And Audio In Html5?
Answer :
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" />
</video>
And audio like
this
<audio controls="controls">
<source src="song.ogg" type="audio/ogg" />
<source src="song.mp3" type="audio/mpeg" />
</audio>
Question 130. What The
Use Of Canvas Element In Html5?
Answer :
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/javascript">
var pcdsCanvas=document.getElementById("pcdsCanvas");
var pcdsText=pcdsCanvas.getContext("2d");
pcdsText.fillStyle="#82345c";
pcdsText.fillRect(0,0,150,75);
</script>
Question 131. What Is
The Use Of Localstorage In Html5 ?
Answer :
Before HTML5 LocalStores
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 localstores just need to call localStorage object like below
we are storing name and address
<script
type="text/javascript">
localStorage.name="PCDS";
document.write(localStorage.name);
</script>
<script type="text/javascript">
localStorage.address="Mumbai India..";
document.write(localStorage.address);
</script>
Question 132. What Is
The Sessionstorage Object In Html5 ? How To Create And Access ?
Answer :
The sessionStorage
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 sessionStorage
here we created "name" as session:
<script
type="text/javascript">
sessionStorage.name="PCDS";
document.write(sessionStorage.name);
</script>
Question 133. What’s New
Html 5 Doctype And Charset?
Answer :
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″>
Question 134. How Can We
Embed Audio In Html5?
Answer :
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:
•MP3
•Wav
•Ogg.
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 does’nt support audio embedding feature.
</audio>
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.
•autoplay – 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.
Question 135. What Are
The New Media Element In Html 5 Other Than Audio And Video?
Answer :
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/quicktime” src=”Fishing.mov”>
<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”>
</video>
<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>
</video>
Question 136. What Are
The Different Types Of Storage In Html 5?
Answer :
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.
•localStorage object stores data for a longer period of time even if the
browser is closed.
•sessionStorage object stores data for a specific session.
Question 137. What Are
The Deprecated Elements In Html5 From Html4?
Answer :
Elements that are
deprecated from HTML 4 to HTML 5 are:
•frame
•frameset
•noframe
•applet
•big
•center
•basefront
Question 138. What Are
The New Apis Provided By Html 5 Standard?
Answer :
HTML 5 standard 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
Question 26. What Is The
Difference Between Html 5 Application Cache And Regular Html Browser Cache?
Answer :
One of the key feature
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, javascript 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, Its 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:
•CACHE MANIFEST
•CACHE
•NETWORK
•FALLBACK
Question 139. What Is
Web Forms 2.0 In Html5?
Answer :
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.
Question 140. Briefly
Explain Cache Manifest File In Html5 With An Example?
Answer :
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:
CACHE MANIFEST
/decorate.css
/work.js
/amazing.jpg
So, the resources
mentioned in above manifest file (decorate.css, work.js, and amazing.jpg) will
be downloaded and cached locally for offline access.
Question 29. What Is An
Html5 Web Worker?
Answer :
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.
Question 141. What Are
The Limitations Of Html5 Web Worker?
Answer :
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
Question 142. List Out
The Tags Those Are Mostly Used In Html?
Answer :
<a
href=”URL”>Link</a> – Used for linking another page.
<h1> – heading1 tag.
<b> – Used for Bold.
<img src=”imageurl”> – To insert a image.
Question 143. What Is
The Difference Between Html And Xhtml?
Answer :
XHTML stands for
Extensible Hyper Text Markup Language.
XHTML is almost
identical to HTML 4.01.
XHTML is a stricter and
cleaner version of HTML.
XHTML is HTML defined as
an XML application.
XHTML is supported by
all major browsers.
XHTML is case sensitive.
Question 144. In How
Many Types We Include Css Style Sheet?
Answer :
There are three types to
write CSS in html:
Inline style sheet.
Internal style sheet.
External style sheet.
Question 145. Who Is
Making The Web Standards?
Answer :
The World Wide Web
Consortium (w3c Consortium).
Question 146. Write A
Background Color In Html?
Answer :
<body
style=”background-color:yellow”>.
Question 147. Write An
Html Code To Create An E-mail Link?
Answer :
<a
href=”mailto:xxx@yyy”>.
Question 148. How Can We
Call The External Style Sheet In Html For Referring?
Answer :
<link
rel=”stylesheet” type=”text/css” href=”mystyle.css”>.
Question 149. How Do We
Comment A Css File?
Answer :
/* include your comment
here*/.
Question 150. How Can We
Make Each Word In A Text Start With A Capital Letter?
Answer :
With this one in css —–
text-transform: capitalize.
Question 151. Why We Use
'clear' In Html?
Answer :
We use the clearance in
HTML code for separating the content from one <div> content after
floating the position of other<div> content.
Question 152. How Many
Types Of Graphics?
Answer :
There are two types of
graphics
Raster Graphics –pixels
(photoshop).
Vector Graphics – Lines
& Curves( Illustrator).
Question 153. What Is A
Layer In Photoshop?
Answer :
Layer is a component
which holds the object. Without affecting the other content, we can modify the
object in it.
Question 154. What Is
Gradient? How To Apply Gradient?
Answer :
Gradient is a mixing of
two or more colors.
Question 155. What Is
Dhtml?
Answer :
DHTML is a combination
of HTML, XHTML, Javascript, Jquery and CSS.
DHTML is a TERM
describing the art of making dynamic and interactive web pages.
Question 156. What Is
Xml?
Answer :
XML stands for
extensible Markup Language.
XML is designed to
transport and store data.
Question 157. What Is
Css?
Answer :
CSS stands for Cascading
Style Sheets.
Styles define how to
display HTML elements.
Styles were added to
HTML 4.0 to solve a problem.
External Style Sheets
can save a lot of work.
External Style Sheets
are stored in CSS files.
Question 158. What Is
Html5?
Answer :
HTML5 will be the new
standard for HTML, XHTML, and the HTML DOM.
HTML5 is still a work in
progress. However, most modern browsers have some HTML5 support.
Question 159. Are Html
Tags Case Sensitive?
Answer :
No HTML tags are not
case sensitive.
Question 160. What Is
Most Used Email Form Script?
Answer :
PHP
Question 161. Which
Operator Used To Convert 00110011 Into 11001100?
Answer :
~ operator is used
convert 00110011 into 11001100.
Question 162. How Can
You Organize Layers As In Photoshop?
Answer :
Yes we can organize
layers.. For example you create a Ball in 1st layer and then in second layer
you create the background. But you should lock all the layers and unlock the
layer which u r working, because unlocked layers will be active always(active
means, if u want to drag the ball, background layers also will be affected).
Question 163. What Is A
Prompt Box?
Answer :
A prompt box allows the
user to enter input by providing a text box.
Question 164. What Is
The Difference Between An Alert Box And A Confirmation Box?
Answer :
An alert box displays
only one button which is the OK button whereas the Confirm box displays two
buttons namely OK and cancel.
Question 165. What Does
"1"+2+4 Evaluate To?
Answer :
Since 1 is a string,
everything is a string, so the result is 124.
Question 167. What Is
Negative Infinity?
Answer :
It’s a number in
JavaScript, derived by dividing negative number by zero.
Question 168. How Do You
Convert Numbers Between Different Bases In Javascript?
Answer :
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).
Question 169. What Does
Isnan Function Do?
Answer :
Return true if the
argument is not a number.
Question 170. What Are
Javascript Types?
Answer :
Number, String, Boolean,
Function, Object, Null, Undefined.
Question 171. What Are
The Five Possible Values For "position"?
Answer :
Values for position:
static, relative, absolute, fixed, inherit.
Question 172. Is Css
Case Sensitive?
Answer :
Cascading Style Sheets
(CSS) is not case sensitive. However, font families, URLs to images, and other
direct references with the style sheet may be. The trick is that if you write a
document using an XML declaration and an XHTML doctype, then the CSS class
names will be case sensitive for some browsers. It is a good idea to avoid
naming classes where the only difference is the case, for example: div.myclass
{ ...} div.myClass { ... } If the DOCTYPE or XML declaration is ever removed
from your pages, even by mistake, the last instance of the style will be used,
regardless of case.
Question 173. What Is
External Style Sheet? How To Link?
Answer :
External Style Sheet is
a template/document/file containing style information which can be linked with
any number of HTML documents. This is a very convenient way of formatting the
entire site as well as restyling it by editing just one file. The file is
linked with HTML documents via the LINK element inside the HEAD element. Files
containing style information must have extension .css, e.g. style.css.
< HEAD > < LINK
REL=STYLESHEET HREF="style.css" TYPE="text/css"> < /
HEAD>
Question 174. How Do I
Add Scrolling Text To My Page?
Answer :
Keep in mind not all
browsers support scrolling text. however to do this add a tag similar to the
below example. < marquee >THIS WOULD SCROLL< /marquee> The above
example would create the below scrolling text. If your browser supports
scrolling text the below example should be scrolling. More examples can be
found on our main HTML page that lists most of the HTML commands.
Question 175. How Do I
Make A Picture As A Background On My Web Pages?
Answer :
Point the body
background to the name of your image you wish to use as the background as shown
below. This body line should be the first line after your < / head> tag.
< body background="picture.gif" >
You can also have the background image fixed, so it does not move when using
the scroll bar in the browser. To do this add the BGPROPERTIES tag as shown
below.
< body background="picture.gif" bgproperties="fixed"
>
Question 176. What Is A
Css File? It Is Used For What Purpose?
Answer :
CSS stands for
"Cascading Style Sheets", and are used to control and manage font
styles, font sizes, and web site color combinations that are used in a web
page. In order to retain continuity of "look and feel" throughout a
website, all pages within a website will often refer to a single CSS file. The
CSS file is typically contained in a separate file from the website, and the
various web pages retrieve the CSS file each time a web page is displayed. CSS
files make global appearance changes easy -- a single change in a CSS file will
mean that any pages using that CSS file will automatically display the changes.
Question 177. Explain Me
What Are The New Media-related Elements In Html5?
Answer :
HTML5 has strong support
for media. There are now special <audio> and <video> tags. There
are additional A/V support tags as well: <embed> is a container for 3rd
party applications. <track> is for adding text tracks to media.
<source> is useful for A/V media from multiple sources.
Question 178. Tell Me
What Is The Syntax Difference Between A Bulleted List And Numbered List?
Answer :
Bulleted lists use the
<ul> tag, which stands for “unordered,” whereas <ol> is used to
create an ordered list.
Question 179. Explain Me
What Is The Difference In Caching Between Html5 And The Old Html?
Answer :
An important feature of
HTML5 is the Application Cache. It creates an offline version of a web application.
and stores website files such as HTML files, CSS, images, and JavaScript,
locally. It is a feature that speeds up site performance.
Question 180. Do You
Know What Elements Have Disappeared?
Answer :
As mentioned above,
<frame> and <frameset> have been eliminated. Other elements that
are no longer supported include: <noframe>, <applet>,
<bigcenter> and <basefront>.
Question 181. Tell Me
How Do You Add An Html Element In Dom Tree?
Answer :
You can use the jQuery
method appendTo() to add an HTML element in DOM tree. This is one of the many
DOM manipulation methods that jQuery provides. You can add an existing element
or a new HTML element, appendTo() add that method in the end of a particular
DOM element.
Question 182. Please
Explain Difference Between $(this) And This Keyword In Jquery?
Answer :
This could be a tricky
question for many jQuery beginners, but indeed it's a simple one. $(this)
returns a jQuery object, on which you can call several jQuery methods e.g.
text() to retrieve text, val() to retrieve value etc, while this represent
current element, and it's one of the JavaScript keyword to denote current DOM
element in a context. You can not call jQuery method on this, until it's
wrapped using $() function i.e. $(this).
Question 183. Tell Us
How Do You Optimize A Website's Assets?
Answer :
File concatenation, file
compression, CDN Hosting, offloading assets, re-organizing and refining code,
etc. Have a few ready.
Question 184. Tell Me
What Is The Difference Between Svg And <canvas>?
Answer :
<Canvas> is an
element that manipulates two-dimensional (2D) pixels while Scalable Vector
Graphics works in 2D and three-dimensional (3D) vectors. Essentially,
<Canvas> is to SVG as Photoshop is to Illustrator.
Question 185. Explain Me
What Is $(document).ready() Function? Why Should You Use It?
Answer :
This is one of the most
important and frequently asked questions. The ready() function is used to
execute code when document is ready for manipulation. jQuery allows you to
execute code, when DOM is fully loaded i.e. HTML has been parsed and the DOM
tree has been constructed. The main benefit of $(document).ready() function is
that, it works in all browser, jQuery handles cross browser difficulties for
you. For curious reader see answer link for more detailed discussion.
Question 186. Explain Me
How Do You Set An Attribute Using Jquery?
Answer :
One more follow-up
question of previous jQuery question, attr() method is overload like many other
methods in JQuery. If you call attr() method with value e.g. attr(name, value),
where name is the name of attribute and value is the new value.
Question 187. Explain Me
The Difference Between Cookies, Sessionstorage, And Localstorage?
Answer :
Cookies are small text
files that websites place in a browser for tracking or login purposes.
Meanwhile, localStorage and sessionStorage are new objects, both of which are
storage specifications but vary in scope and duration. Of the two, localStorage
is permanent and website-specific whereas sessionStorage only lasts as long as
the duration of the longest open tab.
Question 188. Tell Me
What's The Difference Between Standards Mode And Quirks Mode?
Answer :
Quirks Mode is a default
compatibility mode and may be different from browser to browser, which may
result to a lack of consistency in appearance from browser to browser.
Question 189. Do You
Know What Are The New Image Elements In Html5?
Answer :
Canvas and WebGL.
<Canvas> is a new element that acts as a container for graphical elements
like images and graphics. Coupled with JavaScript, it supports 2D graphics.
WebGL stands for Web Graphics Language, a free cross-platform API that is used
for generating 3D graphics in web browsers.
Question 190. Tell Me
What Is The Difference Between Detach() And Remove() Methods In Jquery?
Answer :
Though both detach() and
remove() methods are used to remove a DOM element, the main difference between
them is that detach() keeps track of the last element detached, so that it can
be reattached, while the remove() method does keep a reference of the last
removed method. You can also take a look at the appendTo() method for adding
elements into DOM.
Question 191. Tell Me
What Purpose Do Work Workers Serve And What Are Some Of Their Benefits?
Answer :
Web Workers are
background scripts that do not interfere with the user interface or user
interactions on a webpage, allowing HTML to render uninterrupted while
JavaScript works in the background.
Question 192. Suppose
Our Hyperlink Or Image Is Not Displaying Correctly, What Is Wrong With It?
Answer :
It could be any number
of things, but the most common mistakes are leaving out a tag bracket or quote
missing for href, src, or alt text may be the issue. You should also verify the
link itself.
Question 193. Explain Me
What Is The Difference Between <div> And <frame>?
Answer :
A <div> is a
generic container element for grouping and styling, whereas a <frame>
creates divisions within a web page and should be used within the
<frameset> tag. The use of <frame> and <frameset> are no
longer popular and are now being replaced with the more flexible
<iframe>, which has become popular for embedding foreign elements (ie.
Youtube videos) into a page.
Question 194. Tell Me
How Do You Find All The Selected Options Of Html Select Tag?
Answer :
This is one of the
tricky jQuery question on Interviews. This is a basic question, but don’t
expect every jQuery beginner to know about this. You can use the following jQuery
selector to retrieve all the selected options of <select> tag with
multiple=true :
$('[name=NameOfSelectedTag]
:selected')
This code uses the
attribute selector in combination of :selected selector, which returns only
selected options. You can tweak this and instead of name, you can even use id
attribute to retrieve
<select> tag.
Question 195. Do You
Know What Is The Difference Between Jquery.get() And Jquery.ajax() Method?
Answer :
The ajax() method is
more powerful and configurable, allows you to specify how long to wait and how
to handle error. The get() method is a specialization to just retrieve some
data.
Question 196. Tell Me
How Do You Hide An Image On A Button Click Using Jquery?
Answer :
This jQuery interview
question is based on event handling. jQuery provides good support for handling
events like button click. You can use following code to hide an image, found
using Id or class. What you need to know is the hide() method and how to setup
an even handler for button, to handle clicks, you can use following jQuery code
to do that :
$('#ButtonToClick').click(function(){
$('#ImageToHide').hide();
});
Question 197. Do You
Know The Real Difference Between Html And Html5?
Answer :
From a broader
perspective, HTML was a simple language for laying out text and images on a
webpage, whereas HTML5 can be viewed as an application development platform
that does what HTML does that and more, including better support for audio,
video, and interactive graphics.
It has a number of new
elements, supports offline data storage for applications, and has more robust
exchange protocols. Thus, proprietary plug-in technologies like Adobe Flash,
Microsoft Silverlight, Apache Pivot, and Sun JavaFX are no longer needed,
because browsers can now process these elements without additional
requirements.
Question 198. Explain Me
What Is “semantic Html?”?
Answer :
Semantic HTML is a
coding style where the tags embody what the text is meant to convey. In
Semantic HTML, tags like <b></b> for bold, and <i></i>
for italic should not be used, reason being they just represent formatting, and
provide no indication of meaning or structure. The semantically correct thing
to do is use <strong></strong> and <em></em>. These
tags will have the same bold and italic effects, while demonstrating meaning
and structure (emphasis in this case).
Question 199. Explain Me
What Is The Main Advantage Of Loading Jquery Library Using Cdn?
Answer :
This is a slightly
advanced jQuery question. Well, apart from many advantages including reducing
server bandwidth and faster download, one of the most important is that, if
browser has already downloaded same jQuery version from the same CDN, then it
won't download it again. Since nowadays, many public websites use jQuery for
user interaction and animation, there is a very good chance that the browser
already has the jQuery library downloaded.
Question 200. Do You
Know What Are Data- Attributes Good For?
Answer :
The HTML5 data-
attribute is a new addition that assigns custom data to an element. It was
built to store sensitive or private data that is exclusive to a page or
application, for which there are no other matching attributes or elements.
Question 1. What Is Css?
Answer :
Cascading Style Sheets,
fondly referred to as CSS, is a simple design language intended to simplify the
process of making web pages presentable.
Question 2. What Are
Advantages Of Using Css?
Answer :
Following are the
advantages of using CSS −
•CSS saves time − You can write CSS once and then reuse same sheet in multiple
HTML pages. You can define a style for each HTML element and apply it to as many
Web pages as you want.
•Pages load faster − If you are using CSS, you do not need to write HTML tag
attributes every time. Just write one CSS rule of a tag and apply it to all the
occurrences of that tag. So less code means faster download times.
•Easy maintenance − To make a global change, simply change the style, and all
elements in all the web pages will be updated automatically.
•Superior styles to HTML − CSS has a much wider array of attributes than HTML,
so you can give a far better look to your HTML page in comparison to HTML
attributes.
•Multiple Device Compatibility − Style sheets allow content to be optimized for
more than one type of device. By using the same HTML document, different
versions of a website can be presented for handheld devices such as PDAs and
cell phones or for printing.
•Global web standards − Now HTML attributes are being deprecated and it is
being recommended to use CSS. So its a good idea to start using CSS in all the
HTML pages to make them compatible to future browsers.
•Offline Browsing − CSS can store web applications locally with the help of an
offline catche.Using of this, we can view offline websites.The cache also
ensures faster loading and better overall performance of the website.
•Platform Independence − The Script offer consistent platform independence and
can support latest browsers as well.
Question 3. What Are The
Components Of A Css Style?
Answer :
A style rule is made of
three parts −
Selector − A selector is an
HTML tag at which a style will be applied. This could be any tag like
<h1> or <table> etc.
Property − A property is a
type of attribute of HTML tag. Put simply, all the HTML attributes are
converted into CSS properties. They could be color, border etc.
Value − Values are
assigned to properties. For example, color property can have value either red
or #F1F1F1 etc.
Question 4. What Is Type
Selector?
Answer :
Type selector quite
simply matches the name of an element type. To give a color to all level 1
headings −
h1 {
color: #36CFFF;
}
Question 5. What Is
Universal Selector?
Answer :
Rather than selecting
elements of a specific type, the universal selector quite simply matches the
name of any element type
* {
color: #000000;
}
This rule renders the
content of every element in our document in black.
Question 6. What Is
Descendant Selector?
Answer :
Suppose you want to
apply a style rule to a particular element only when it lies inside a
particular element. As given in the following example, style rule will apply to
<em> element only when it lies inside <ul> tag.
ul em {
color: #000000;
}
Question 7. What Is
Class Selector?
Answer :
You can define style
rules based on the class attribute of the elements. All the elements having
that class will be formatted according to the defined rule.
.black {
color: #000000;
}
This rule renders the
content in black for every element with class attribute set to black in our document.
Question 8. Can You Make
A Class Selector Particular To An Element Type?
Answer :
You can make it a bit
more particular. For example
h1.black
{
color: #000000;
}
This rule renders the
content in black for only elements with class attribute set to black.
Question 9. What Is Id
Selector?
Answer :
You can define style
rules based on the id attribute of the elements. All the elements having that
id will be formatted according to the defined rule.
#black {
color: #000000;
}
This rule renders the
content in black for every element with id attribute set to black in our
document.
Question 10. Can You
Make A Id Selector Particular To An Element Type?
Answer :
can make it a bit more
particular.
For example:
h1#black
{
color: #000000;
}
This rule renders the
content in black for only elements with id attribute set to black.
Question 11. What Is A
Child Selector?
Answer :
Consider the following
example:
body > p
{
color: #000000;
}
This rule will render
all the paragraphs in black if they are direct child ofelement. Other
paragraphs put inside other elements like or would not have any effect of this
rule.
Question 12. What Is An
Attribute Selector?
Answer :
You can also apply
styles to HTML elements with particular attributes. The style rule below will
match all the input elements having a type attribute with a value of text
input[type =
"text"]
{
color: #000000;
}
The advantage to this
method is that the element is unaffected, and the color
applied only to the desired text fields.
Question 13. How To
Select All Paragraph Elements With A Lang Attribute?
Answer :
p[lang] : Selects all
paragraph elements with a lang attribute.
Question 14. How To
Select All Paragraph Elements Whose Lang Attribute Has A Value Of Exactly
"fr"?
Answer :
p[lang="fr"] -
Selects all paragraph elements whose lang attribute has a value of exactly
"fr".
Question 15. How To
Select All Paragraph Elements Whose Lang Attribute Contains The Word
"fr"?
Answer :
p[lang~="fr"]
- Selects all paragraph elements whose lang attribute contains the word
"fr".
Question 16. How To
Select All Paragraph Elements Whose Lang Attribute Contains Values That Are
Exactly "en", Or Begin With "en-"?
Answer :
p[lang|="en"]
- Selects all paragraph elements whose lang attribute contains values that are
exactly "en", or begin with "en-".
Question 17. What Are
The Various Ways Of Using Css In An Html Page?
Answer :
There are four ways to
associate styles with your HTML document. Most commonly used methods are inline
CSS and External CSS.
Embedded CSS − The
Question 18. How Css
Style Overriding Works?
Answer :
Following is the rule to
override any Style Sheet Rule
Any inline style sheet
takes highest priority. So, it will override any rule defined in
<style>...</style> tags or rules defined in any external style
sheet file.
Any rule defined in
<style>...</style> tags will override rules defined in any external
style sheet file.
Any rule defined in
external style sheet file takes lowest priority, and rules defined in this file
will be applied only when above two rules are not applicable.
Question 19. What Is The
Purpose Of % Measurement Unit?
Answer :
% - Defines a
measurement as a percentage relative to another value, typically an enclosing
element.
p {font-size: 16pt; line-height: 125%;}
Question 20. What Is The
Purpose Of Cm Measurement Unit?
Answer :
cm − Defines a
measurement in centimeters.
div {margin-bottom:
2cm;}
Question 21. What Is The
Purpose Of Em Measurement Unit?
Answer :
em − A relative
measurement for the height of a font in em spaces. Because an em unit is
equivalent to the size of a given font, if you assign a font to 12pt, each
"em" unit would be 12pt; thus, 2em would be 24pt.
p {letter-spacing: 7em;}
Question 22. What Is The
Purpose Of Ex Measurement Unit?
Answer :
ex − This value defines
a measurement relative to a font's x-height. The x-height is determined by the
height of the font's lowercase letter.
p {font-size: 24pt;
line-height: 3ex;}
Question 23. What Is The
Purpose Of In Measurement Unit?
Answer :
in − Defines a
measurement in inches.
p {word-spacing: .15in;}
Question 24. What Is The
Purpose Of Mm Measurement Unit?
Answer :
mm − Defines a
measurement in millimeters.
p {word-spacing: 15mm;}
Question 25. What Is The
Purpose Of Pc Measurement Unit?
Answer :
pc − Defines a
measurement in picas. A pica is equivalent to 12 points; thus, there are 6
picas per inch.
p {font-size: 20pc;}
Question 26. What Is The
Purpose Of Pt Measurement Unit?
Answer :
pt − Defines a
measurement in points. A point is defined as 1/72nd of an inch.
body {font-size: 18pt;}
Question 27. What Is The
Purpose Of Px Measurement Unit?
Answer :
px − Defines a
measurement in screen pixels.
p {padding: 25px;}
Question 28. What Is The
Purpose Of Vh Measurement Unit?
Answer :
vh − 1% of viewport
height.
h2 { font-size: 3.0vh; }
Question 29. What Is The
Purpose Of Vw Measurement Unit?
Answer :
vw − 1% of viewport
width.
h1 { font-size: 5.9vw;
}
Question 30. What Is The
Purpose Of Vmin Measurement Unit?
Answer :
vmin 1vw or 1vh,
whichever is smaller.
p { font-size: 2vmin;}
Question 31. What Are
Browser Safe Colors?
Answer :
There is the list of 216
colors which are supposed to be most safe and computer independent colors.
These colors vary from hexa code 000000 to FFFFFF. These colors are safe to use
because they ensure that all computers would display the colors correctly when
running a 256 color palette.
Question 32. Which
Property Is Used To Set The Background Color Of An Element?
Answer :
The background-color property
is used to set the background color of an element.
Question 33. Which
Property Is Used To Set The Background Image Of An Element?
Answer :
The background-image
property is used to set the background image of an element.
Question 34. Which
Property Is Used To Control The Repetition Of An Image In The Background?
Answer :
The background-repeat
property is used to control the repetition of an image in the background.
Question 35. Which
Property Is Used To Control The Position Of An Image In The Background?
Answer :
The background-position
property is used to control the position of an image in the background.
Question 36. Which
Property Is Used To Control The Scrolling Of An Image In The Background?
Answer :
The
background-attachment property is used to control the scrolling of an image in
the background.
Question 37. Which
Property Is Used As A Shorthand To Specify A Number Of Other Background
Properties?
Answer :
The background property
is used as a shorthand to specify a number of other background properties.
Question 38. Which
Property Is Used To Change The Face Of A Font?
Answer :
The font-family property
is used to change the face of a font.
Question 39. Which
Property Is Used To Make A Font Italic Or Oblique?
Answer :
The font-style property
is used to make a font italic or oblique.
Question 40. Which
Property Is Used To Create A Small-caps Effect?
Answer :
The font-variant
property is used to create a small-caps effect.
Question 41. Which
Property Is Used To Increase Or Decrease How Bold Or Light A Font Appears?
Answer :
The font-weight property
is used to increase or decrease how bold or light a font appears.
Question 42. Which
Property Is Used To Increase Or Decrease The Size Of A Font?
Answer :
The font-size property
is used to increase or decrease the size of a font.
Question 43. Which
Property Is Used As Shorthand To Specify A Number Of Other Font Properties?
Answer :
The font property is
used as shorthand to specify a number of other font properties.
Question 44. Which
Property Is Used To Set The Color Of A Text?
Answer :
The color property is
used to set the color of a text.
Question 45. Which
Property Is Used To Set The Text Direction?
Answer :
The direction property
is used to set the text direction.
Question 46. Which
Property Is Used To Add Or Subtract Space Between The Letters That Make Up A
Word?
Answer :
The letter-spacing
property is used to add or subtract space between the letters that make up a
word.
Question 47. Which
Property Is Used To Add Or Subtract Space Between The Words Of A Sentence?
Answer :
The word-spacing
property is used to add or subtract space between the words of a sentence.
Question 48. Which
Property Is Used To Indent The Text Of A Paragraph?
Answer :
The text-indent property
is used to indent the text of a paragraph.
Question 49. Which
Property Is Used To Align The Text Of A Document?
Answer :
The text-align property
is used to align the text of a document.
Question 50. Which
Property Is Used To Underline, Overline, And Strikethrough Text?
Answer :
The text-decoration
property is used to underline, overline, and strikethrough text.
Question 51. Which
Property Is Used To Capitalize Text Or Convert Text To Uppercase Or Lowercase
Letters?
Answer :
The text-transform
property is used to capitalize text or convert text to uppercase or lowercase
letters.
Question 52. Which
Property Is Used To Control The Flow And Formatting Of Text?
Answer :
The white-space property
is used to control the flow and formatting of text.
Question 53. Which
Property Is Used To Set The Text Shadow Around A Text?
Answer :
The text-shadow property
is used to set the text shadow around a text.
Question 54. Which
Property Is Used To Set The Width Of An Image Border?
Answer :
The border property is
used to set the width of an image border.
Question 55. Which
Property Is Used To Set The Height Of An Image?
Answer :
The height property is
used to set the height of an image.
Question 56. Which
Property Is Used To Set The Width Of An Image?
Answer :
The width property is
used to set the width of an image.
Question 57. Which
Property Is Used To Set The Opacity Of An Image?
Answer :
The -moz-opacity
property is used to set the opacity of an image.
Question 58. Which
Property Of A Hyperlink Signifies Unvisited Hyperlinks?
Answer :
The :link signifies
unvisited hyperlinks.
Question 59. Which
Property Of A Hyperlink Signifies Visited Hyperlinks?
Answer :
The :visited signifies
visited hyperlinks.
Question 60. Which
Property Of A Hyperlink Signifies An Element That Currently Has The User's
Mouse Pointer Hovering Over It?
Answer :
The :hover signifies an
element that currently has the user's mouse pointer hovering over it.
Question 1. What Is
Javascript?
Answer :
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.
Question 2. How Is
Javascript Different From Java?
Answer :
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.
Question 3. What’s
Relationship Between Javascript And Ecmascript?
Answer :
ECMAScript is yet
another name for JavaScript (other names include LiveScript). The current
JavaScript that you see supported in browsers is ECMAScript revision 3.
Question 4. How Do You
Submit A Form Using Javascript?
Answer :
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).
Question 5. Is There A
Site That Shows Which Tags Work On Which Browsers?
Answer :
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.
Question 6. Why Does The
Browser Show My Plain Html Source?
Answer :
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.
Question 7. How Can I
Display An Image On My Page?
Answer :
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">
Question 8. Why Do My
Links Open New Windows Rather Than Update An Existing Frame?
Answer :
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.
Question 9. How Do I Get
Out Of A Frameset?
Answer :
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.
Question 10. When I Try
To Upload My Site, All My Images Are X's. How Do I Get Them To Load Correctly?
Answer :
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.
Question 11. How Do I
Make A Frame With A Vertical Scrollbar But Without A Horizontal Scrollbar?
Answer :
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.
Question 12. Are There
Any Problems With Using Frames?
Answer :
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.
Question 13. How Do I
Keep People From Stealing My Source Code And/or Images?
Answer :
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.
Question 14. How Do You
Create Tabs Or Indents In Web Pages?
Answer :
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.
Question 15. How Do I
Make Sure My Framed Documents Are Displayed Inside Their Frame Set?
Answer :
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)
window.location.replace('frameset.html');
else
// causes problems with back button, but works
window.location.href = 'frameset.html';
}
</SCRIPT>
A more universal approach is a "restore frames" link:
<A HREF="frameset.html" TARGET="_top">Restore
Frames
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.
Question 16. How Do I
Update Two Frames At Once?
Answer :
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">
<noframes>
<!-- Alternative non-framed version -->
</body></noframes>
</frameset>
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).
Question 17. What Is Html?
Answer :
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.
Question 18. What Is A
Tag?
Answer :
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.
Question 19. What Is The
Simplest Html Page?
Answer :
HTML Code:
<HTML>
<HEAD>
<TITLE>This is my page title! </TITLE>
</HEAD>
<BODY>
This is my message to the world!
</BODY>
</HTML>
Browser Display:
This is my message to the world!
Question 20. How Do I
Create Frames? What Is A Frameset?
Answer :
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.
Question 21. What Is A
Hypertext Link?
Answer :
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.
Question 22. What Does
Break And Continue Statements Do?
Answer :
Continue statement
continues the current loop (if label not specified) in a new iteration whereas
break statement exits the current loop.
Question 23. How To
Create A Function Using Function Constructor?
Answer :
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");
Question 24. How To Make
A Array As A Stack Using Javascript?
Answer :
The pop() and push()
functions turn a harmless array into a stack
<script type="text/javascript">
var numbers = ["one", "two", "three",
"four"];
numbers.push("five");
numbers.push("six");
document.write(numbers.pop());
document.write(numbers.pop());
document.write(numbers.pop());
</script>
This produces
sixfivefour
Question 25. How To
Shift And Unshift Using Javascript?
Answer :
<script
type="text/javascript">
var numbers = ["one", "two", "three",
"four"];
numbers.unshift("zero");
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
</script>
This produces
zero one two
shift, unshift, push, and pop may be used on the same array. Queues are easily
implemented using combinations.
Question 26. What Are
Javascript Types?
Answer :
Number, String, Boolean,
Function, Object, Null, Undefined.
Question 27. How Do You
Convert Numbers Between Different Bases In Javascript?
Answer :
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);
Question 28. How To
Create Arrays In Javascript?
Answer :
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);
Question 29. How Do You
Target A Specific Frame From A Hyperlink?
Answer :
Include the name of the
frame in the target attribute of the hyperlink. <a href=”mypage.htm”
target=”myframe”>>My Page</a>
Question 30. What Can
Javascript Programs Do?
Answer :
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
Question 31. How To Set
A Html Document's Background Color?
Answer :
document.bgcolor
property can be set to any appropriate color.
Question 32. How Can
Javascript Be Used To Personalize Or Tailor A Web Site To Fit Individual Users?
Answer :
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.
Question 33. Are You
Concerned That Older Browsers Don't Support Javascript And Thus Exclude A Set
Of Web Users? Individual Users?
Answer :
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.
Question 34. What Does
Isnan Function Do?
Answer :
Return true if the
argument is not a number.
Question 35. What Is
Negative Infinity?
Answer :
It’s a number in
JavaScript, derived by dividing negative number by zero.
Question 36. In A Pop-up
Browser Window, How Do You Refer To The Main Browser Window That Opened It?
Answer :
Use window.opener to
refer to the main window from pop-ups.
Question 37. What Is The
Data Type Of Variables Of In Javascript?
Answer :
All variables are of
object type in JavaScript.
Question 38. Methods Get
And Post In Html Forms - What's The Difference?
Answer :
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.
Question 39. How To
Write A Script For "select" Lists Using Javascript
Answer :
To remove an item from a
list set it to null.
mySelectObject.options[3] = null;
To truncate a list set
its length to the maximum size you desire.
mySelectObject.length = 2;
To delete all options in
a select object set the length to 0.
mySelectObject.leng
Question 40. Text From
Your Clipboard?
Answer :
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.
Question 41. What Does
The "access Is Denied" Ie Error Mean?
Answer :
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.
Question 42. Is A
Javascript Script Faster Than An Asp Script?
Answer :
Yes.Since javascript 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..
Question 43. Are Java
And Javascript The Same?
Answer :
No.java and javascript
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.
Question 44. How To
Embed Javascript In A Web Page?
Answer :
javascript code can be
embedded in a web page between <script
langugage="javascript"></script> tags
Question 45. What And
Where Are The Best Javascript Resources On The Web?
Answer :
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.
Question 46. What Are
The Problems Associated With Using Javascript, And Are There Javascript
Techniques That You Discourage?
Answer :
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, scripters 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 scripters
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.
Question 47. What
Boolean Operators Does Javascript Support?
Answer :
&&
||
!
Question 48. What Does
"1"+2+4 Evaluate To?
Answer :
Since 1 is a string,
everything is a string, so the result is 124.
Question 49. What Is The
Difference Between A Web-garden And A Web-farm?
Answer :
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).
Question 50. How To Get
The Contents Of An Input Box Using Javascript?
Answer :
Use the
"value" property.
var myValue = window.document.getElementById("MyTextBox").value;
Question 51. How To
Determine The State Of A Checkbox Using Javascript?
Answer :
var checkedP =
window.document.getElementById("myCheckBox").checked;
Question 52. How To Set
The Focus In An Element Using Javascript?
Answer :
<script> function
setFocus() { if(focusElement != null) {
document.forms[0].elements["myelementname"].focus(); } }
</script>
Question 53. How To
Access An External Javascript File That Is Stored Externally And Not Embedded?
Answer :
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 javscript file to be accessed.
Question 54. What Is The
Difference Between An Alert Box And A Confirmation Box?
Answer :
An alert box displays
only one button which is the OK button whereas the Confirm box displays two
buttons namely OK and cancel.
Question 55. What Is A
Prompt Box?
Answer :
A prompt box allows the
user to enter input by providing a text box.
Question 56. Can
Javascript Code Be Broken In Different Lines?
Answer :
Breaking is possible
within a string statement by using a backslash at the end but not within any
other javascript statement.that is ,
document.write("Hello world");
is possible but not
document.write
("hello world");
Question 57. Taking A
Developer’s Perspective, Do You Think That That Javascript Is Easy To Learn And
Use?
Answer :
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.
Question 58. What Web
Sites Do You Feel Use Javascript Most Effectively (i.e., Best-in-class
Examples)? The Worst?
Answer :
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.
Question 59. What Is The
Difference Between Sessionstate And Viewstate?
Answer :
ViewState 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.
Question 60. What Does
The Enableviewstatemac Setting In An Aspx Page Do?
Answer :
Setting
EnableViewStateMac=true is a security measure that allows ASP.NET to ensure
that the viewstate for a page has not been tampered with. If on Postback, the
ASP.NET framework detects that there has been a change in the value of
viewstate that was sent to the browser, it raises an error - Validation of
viewstate 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.
Question 1. What Is
J-query?
Answer :
JQuery is a light weight
JavaScript library which provides fast and easy way of HTML DOM traversing and
manipulation, its event handling, its client side animations, etc. One of the
greatest features of jQuery is that jQuery supports an efficient way to implement
AJAX applications because of its light weight nature and make normalize and
efficient web programs.
Question 2. How To Use
Jquery?
Answer :
jQuery can be easily used
with other libraries so it should work out of the box with simple and complex
JavaScript and Ajax.
Question 3. What
Distinguishes Php From Something Like Client Side Java Script?
Answer :
Java script applied on
client side while in php code executed on server reviews side.
Question 4. In Php How
Can You Jump In To And Out Of "php Mode"?
Answer :
The Php code is enclosed
in special Start < ? and end ? > tags that allow ingredients you to jump
in to and out of “php mode”.
Question 5. How To Use
Jquery Library In Our Asp.net Project?
Answer :
Download the latest
jQuery library from jQuery.com and include the reference to the jQuery library
file in our ASPX page.
<script
src="_scripts/jQuery-1.2.6.js"
type="text/javascript"></script>
<script language="javascript">
$(document).ready(function() {
alert('test');
});
</script>
Question 6. What Is
Jquery Connect?
Answer :
It is a jquery plugin
which enables us to connect a function to another function. It is like
assigning a handler for another function. This situation happens when you are
using any javascript plugins and you want to execute some function when ever
some function is executed from the plugin. This we can solve using jquery connect
function.
Question 7. How To Use
Jquery.connect?
Answer :
download
jquery.connect.js file.
include this file in
your html file.
and use $.connect
function to connect a function to another function.
Question 8. Different
Ways Of Using $.connect Function In Jquery?
Answer :
The syntax of connect
function is
$.connect(sourceObj/*object*/, sourceFunc/*string*/, callObj/*object*/,
callFunc/*string or Func*/)
sourceObj(optional) is
the object of the source function to which we want to connect.
sourceFunc is the
function name to which we want to connect.
callObj(optional) is the
object which we want to use for the handler function.
callFunc is the function
that we want to execute when sourceFunc is executed.
Here sourceObj, callObj
are optional for the global functions.
suppose if your sourceFunc is global function then no need to pass the
sourceObj or you can use null or self.
suppose if your callObj is global function then no need to pass the callObj or
you can use null or self.
Question 9. Explain The
Concepts Of "$ Function" In Jquery With An Example?
Answer :
The type of a function
is "function".
There are a lot of anonymous functions is jquery.
$(document).ready(function() {});
$("a").click(function() {});
$.ajax({
url: "someurl.php",
success: function() {}
});
Question 10. Why Is Jquery
Better Than Javascript?
Answer :
jQuery is great library
for developing ajax based application.
It helps the programmers
to keep code simple and concise and reusable.
jQuery library
simplifies the process of traversal of HTML DOM tree.
jQuery can also handle
events, perform animation, and add the Ajax support in web applications.
Question 11. Explain How
Jquery Works?
Answer :
<html>
<head>
<script
type="text/javascript"
src="jquery.js"></script>
<script
type="text/javascript">
// You can write the code here
</script>
</head>
<body>
<a
href="http://www.wisdomjobs.com/">WisdomJobs</a>
</body>
</html>
Question 12. When Can
You Use Jquery?
Answer :
jQuery can be used to
for developing ajax based applications.
It can be used to keep
the code simple, concise and reusable.
It simplifies the
process of traversal of HTML DOM tree.
It can also handle
events, perform animation, and add the ajax support in web applications.
Question 13. What Is A
Jquery ?
Answer :
It’s very simple but
most valuable Question on jQuery means jQuery is a fast and concise JavaScript
Library that simplifies HTML document traversing, animating, event handling,
and Ajax interactions for rapid web development. jQuery is designed to change the
way that you write JavaScript. jQuery is build library for javascript no need
to write your own functions or script jQuery all ready done for you.
Question 14. Change The
Url For A Hyperlink Using Jquery?
Answer :
There are three way to
change the URL for a Hyperlink using jQuery.
$("a").attr("href",
"http://www.wisdomjobs.com/");
$("a[href='http://www.wisdomjobs.com/']")
.attr('href', 'http://wisdomjobs.com/');
$("a[href^='http://wisdomjobs.com']").each(function(){
this.href = this.href.replace(/^http: / / beta.wisdomjobs.com/,
"http://wisdomjobs.com"); });
Question 15. Check Or
Uncheck All Checkboxes Using Jquery?
Answer :
There are different
methods to check and uncheck the check boxes.
suppose that you have checkboxes like that
<input
type=”checkbox” value=”1″ name=”Items” id=”Items1″ />
<input type=”checkbox” value=”2″ name=”Items” id=”Items2″ />
<input type=”checkbox” value=”3″ name=”Items” id=”Items3″ />
<input type=”checkbox” value=”4″ name=”Items” id=”Items4″ />
using attr() function.
$(‘#checkall’).click(function(){
$(“input[@name='Items']:checked”).attr(‘checked’,true);
});
$(‘#uncheckall’).click(function(){
$(“input[@name='Items']:checked”).attr(‘checked’,false);});
using attr() and removeAttr()funstions
$(‘#checkall’).click(function(){
$(“input[@name='Items']:checked”).attr(‘checked’,true);
})
$(‘#uncheckall’).click(function(){
$(“input[@name='Items']:checked”).removeAttr(‘checked’);})
Question 16. Fetch The
Values Of Selected Checkbox Array Using Jquery?
Answer :
Suppose that below is
checkbox array
<input type=”checkbox” value=”1″ name=”Items[]“ id=”Items1″ />
<input type=”checkbox” value=”2″ name=”Items[]“ id=”Items2″ />
<input type=”checkbox” value=”3″ name=”Items[]“ id=”Items3″ />
<input type=”checkbox” value=”1″ name=”Items[]“ id=”Items4″ />
and we want the get the value of selected checkbox using jquery.
then simple use below code.
var selItems = new Array();
$(input[@name='Items[]‘]:checked”).each(function() {selItems .push($(this).val());});
Here selItems will take all selected value of checkbox.
Question 17. How We Can
Apply Css In Multiple Selectors In Jquery?
Answer :
Here to take effect is
example to demonstrate
$(“div,span,p.myClass”).css(“border”,”1px solid green”);
the border will be apply in all div,span ,p.myClass class element.
Question 18. How We Can
Modify The Css Class In Jquery?
Answer :
Using css method we can
modify class using jquery
example:$(“.CssClass1.CssClass2″).css(“border”,”1px solid green”);
CssClass1,CssClass2 will be modify to border 1px solid green.
Question 19. How Can We
Apply Css In Div Using Jquery?
Answer :
using css() method we
can apply css in div element.
example:
$(“div”).css(“border”,”1px solid green”);
Question 20. Get The
Value Of Selected Option In Jquery?
Answer :
<select id="sel">
<option value="1">Hi</option>
<option
value="2">Hello</option>
<option
value="3">Helloooooo</option>
<option
value="4">ok</option>
<option
value="5">Okey</option>
</select>
want to get
the value of selected option, then use
$("select#sel").val();
or text of selected box,
then use
$("#seloption:selected").text();
Question 21.
Check/uncheck An Input In Jquery?
Answer :
Using two function, we
can perform the operation.
// Check #x
$(“#checkboxid”).attr(“checked”, “checked”);
// Uncheck #x
$(“#checkboxid”).removeAttr(“checked”);
Question 22.
Disable/enable An Element In Jquery?
Answer :
// Disable #x
$(“#x”).attr(“disabled”,”disabled”);
// Enable #x
$(“#x”).removeAttr(“disabled”);
Question 23. What Are The Advantages Of Jquery?
Answer :
The advantages of using
jQuery are:
JavaScript enhancement
without the overhead of learning new syntax.
Ability to keep the code
simple, clear, readable and reusable.
Eradication of the
requirement of writing repetitious and complex loops and DOM scripting library
calls.
Question 24. Explain The
Features Of Jquery?
Answer :
Features of jQuery are :
Effects and animations
Ajax
Extensibility
DOM element selections
functions
Events
CSS manipulation
Utilities – such as
browser version and the each function.
JavaScript Plugins
DOM traversal and
modification.
Question 25. How Can We
Apply Css In Odd Childs Of Parent Node Using Jquery Library?
Answer :
$(”tr:odd”).css(”background-color”,
“#bbbbff”);
Question 26. How Can We
Apply Css In Even Childs Of Parent Node Using Jquery Library?
Answer :
$(”tr:even”).css(”background-color”,
“#bbbbff”);
Question 27. How Can We
Apply Css In Last Child Of Parent Using Jquery Library?
Answer :
$(”tr:last”).css({backgroundColor:
‘yellow’, fontWeight: ‘bolder’});
Question 28. What Does A
Special Set Of Tags Do In Php?
Answer :
The tags <?= and
?> displayed output directly to the web browser.
Question 29. How Can We
Calculate The Similarity Between Two Strings?
Answer :
Using similar_text() get
similarity between two strings.
Return Values
Returns the number of
matching chars in both strings.
example
<?php
$first =’php3′;
$first =’php4′;
echo retail price similar_text (
$first, $second ) //3
?>
Question 30. Return
Ascii Value Of Character In Php?
Answer :
using ord() method we
can get ASCII value of character in php.
<?php
$str = "n" style="color: #007700;">;
if (ord style="color:
#0000bb;">$str) == 10) {
echo "The first character of $str is a line feed.n";
}
?>
Question 31. How Can I
Execute A Php Script Using Command Line?
Answer :
Just run the PHP CLI
(Command Line Interface) program and provide the PHP script file name as the
command line argument. For example, “php myScript.php”, assuming “php” is the
command to invoke the CLI program. Be aware that if your PHP script was written
for the Web CGI interface, it may not execute properly in command line
environment.
Question 32. What
Difference Between Require() And Require_once()?
Answer :
Require()
The Require() is used to include a file, It create fatal error if file not
found and terminate script.
require_once()
The require_once() to require() except PHP will check if the file has already
been included, and if so, tricor online not include (require) it again.
Question 33. What Does
Dollar Sign ($) Means In Jquery?
Answer :
Dollar Sign is nothing
but it's an alias for JQuery. Take a look at below jQuery code
$(document).ready(function(){
});
Over here $ sign can be
replaced with "jQuery " keyword.
jQuery(document).ready(function(){
});
Question 34. Mac,
Windows Or Linux? Why Do You Love This Platform While Using Jquery?
Answer :
I switched to Mac
hardware around a year ago and I’m totally in love with it. All components work
together nicely, and so far, I never had to return my Mac book Pro to the Apple
Store because of an issue. However, I’m still using Windows through Parallels
because OSX, while visually nice and stable, has fundamental usability flaws.
One of these flaws is the Finder. I recently worked on the jQuery UI
Selectables in the labs version, and once again saw that the Finder had great
flaws when it comes down to selection. For instance, if you select multiple
items and click on one of them, the multiple selection isn’t cleared. Also, my
tools that I love for windows simply don’t have an alternative yet .
Question 35. How Is Body
Onload() Function Is Different From Document.ready() Function Used In Jquery?
Answer :
Document.ready()
function is different from body onload() function because off 2 reasons.
We can have more than one
document.ready() function in a page where we can have only one onload function.
Document.ready()
function is called as soon as DOM is loaded where body.onload() function is
called when everything gets loaded on the page that includes DOM, images and
all associated resources of the page.
Question 36. What Is
Jquery Ui?
Answer :
JQuery UI is a library
which is built on top of JQuery library. JQuery UI comes with cool widgets,
effects and interaction mechanism.
Question 37. Name Some
Of The Methods Of Jquery Used To Provide Effects?
Answer :
Some of the common
methods are :
Show()
Hide()
Toggle()
FadeIn()
FadeOut().
Question 38. What Are
The Different Type Of Selectors In Jquery?
Answer :
There are 3 types of
selectors in Jquery
CSS Selector
XPath Selector
Custom Selector.
Question 39. How Can You
Select All Elements In A Page Using Jquery?
Answer :
To select all elements
in a page, we can use all selectors, for that we need to use *(asterisk
symbol).
<script language="javascript" type="text/javascript">
$("*").css("border", "2px dotted red");
</script>
Question 40. Which
Version Of Jquery File Should Be Used?
Answer :
In most of the recent
releases so far, the core functionality of jQuery remains same however some
more cool and better features are added. Ideally you should use the latest
jQuery files available. By doing this you ensure that your earlier
functionality will still work and you can use new features available as part of
the new release.
Question 41. What Are
Selectors In Jquery Mean ?
Answer :
Generally in HTML, if we
need to work with any control on a web page we need to find the control. For
that we use document.getElementByID or document.getElementByName. But in jquery
we do it using Selectors.
Using this selectors we can select all the controls as well using a symbol (* )
A sample code snippet can be of this form
<script language="javascript"
type="text/javascript">
$("*").css("border",
"10px red");
</script>
Question 42. Do We Need
To Add The Jquery File Both At The Master Page And Content Page As Well?
Answer :
No, if the Jquery file
has been added to the master page then we can access the content page directly
without adding any reference to it.
This can be done using this simple example
<script type="text/javascript" src="jQuery-1.4.1-min.js"></script>
Question 43. What Is The
Advantage Of Using The Minified Version Of Jquery Rather Than Using The
Conventional One?
Answer :
The advantage of using a
minified version of JQuery file is Efficiency of the web page increases.
The normal version
jQuery-x.x.x.js has a file size of 178KB but the minified version
jQuery.x.x.x-min.js has 76.7 KB.
The reduction in size
makes the page to load more faster than you use a conventional jQuery file with
178KB.
Question 44. What Is Cdn
And How Jquery Is Related To It?
Answer :
CDN - It stands for
Content Distribution Network or Content Delivery Network.
Generally, a group of systems at various places connected to transfer data
files between them to increase its bandwidth while accessing data. The typical
architecture is designed in such a way that a client access a file copy from
its nearest client rather than accessing it from a centralized server.
So we can load this jQuery file from that CDN so that the efficiency of all the
clients working under that network will be increased.
Example :
We can load jQuery from Google libraries API
<script type="text/javascript" language="Javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
Question 45. Can We
Select A Element Having A Specific Class In Jquery ?
Answer :
Yes, we can select an
element with a specific class, we use the class selector.The class name must
contain the prefix as "." (dot).
<script language="javascript"
type="text/javascript">
$(".class1").css("border",
"2px solid red");
</script>
Question 46. What Are
Features Of Jquery Or What Can Be Done Using Jquery?
Answer :
Features of Jquery:
One can easily provide
effects and can do animations.
Applying / Changing CSS.
Cool plugins.
Ajax support
DOM selection events
Event Handling.
Question 47. What Are
The Advantages Of Jquery ?
Answer :
There are many
advantages with JQuery. Some of them are :
It is more like a
JavaScript enhancement so there is no overhead in learning a new syntax.
It has the ability to
keep the code simple, readable, clear and reusable.
It would eradicate the
requirement for writing complex loops and DOM scripting library calls.
Question 48. Why Jquery?
Answer :
jQuery is very compact
and well written JavaScript code that increases the productivity of the
developer by enabling them to achieve critical UI functionality by writing very
less amount of code.
It helps to
Improve the performance
of the application
Develop most browser
compatible web page
Implement UI related
critical functionality without writing hundreds of lines of codes
Fast
Extensible – jQuery can
be extended to implement customized behavior.
Other advantages of
jQuery are
No need to learn fresh
new syntax's to use jQuery, knowing simple JavaScript syntax is enough.
Simple and Cleaner code,
no need to write several lines of codes to achieve complex functionality.
Question 49. What Is The
Use Of Delegate() Method In Jquery?
Answer :
The delegate() method
can be used in two ways.
1) If you have a parent element, and you want to attach an event to each one of
its child elements, this delegate() method is used.
Ex:Un-ordered
2) When an element is not available on the current page, this method is used.
.live() method is also used for the same purpose but, delegate() method is a
bit faster.
Question 50. What Is The
Name Of Jquery Method Used For An Asynchronous Http Request?
Answer :
jQuery.ajax().