Source One Educational Society Source One Educational Society
Home | OS Install | MS-Office | Photoshop | SQL | Networking | HTML | Java | Model Papers | FAQ's | Health Tips | News | Jobs | Fun SMS
Technology
 
 
 
 
JAVASCRIPT FREQUENTLY ASKED QUESTIONS
   

Where can I get JavaScript documentation?

Ans:) Online JavaScript documentation is available at these sites:

  • http://developer.netscape.com - Netscape's JavaScript Guide, Reference, and
    more
  • http://msdn.microsoft.com/workshop - Microsoft's JScript,DHTML info, etc.

In addition, you can find JavaScript discussions, online tutorials, links,
code examples, and hundreds of useful scripts at the following sites (of course this
list is incomplete and serves only as a starting point):

  • http://www.WebReference.com/JavaScript/ - tutorials and in-depth discussions
  • http://www.JavaScripts.com - lots of scripts and code examples
  • http://www.24fun.ch - another good site with lots of scripts
  • http://www.DanSteinman.com/dynduo - a great cross-platform JavaScript 1.2 API
  • http://www.irt.org - a FAQ collection
  • http://www.WebCoder.com - How-to's, JavaScript/CSS Reference, demos,
    examples
  • http://www.aBetterServer.com/links/javascript.html - a wealth of useful JS
    links, as well as a search engine placement service
 
How do I insert comments in JavaScript code?

Ans:) JavaScript supports three different types of comments:

  1. Multiple-line C-style comments. Everything between /* and */ is a comment,
    for example:
    /* This is a comment */
    /* C-style comments can span
    as many lines as you like,
    as shown in this example */
  2. One-line comments of C++ style. These comments begin with // and continue
    up to the next line break:
    // This is a one-line comment
  3. One-line comments with the HTML comment-opening sequence (<!--). Note that
    the JavaScript interpreter ignores the closing characters of HTML comments (-->).
    Consider this example: <!-- This is treated as a one-line JS comment
    <!-- It works just like a comment beginning with //
    <!-- --> This is also a one-line JS comment
    <!-- --> because JS ignores the closing characters
    <!-- --> of HTML-style comments
 
How do I hide JS code from old browsers that do not support JavaScript?

Ans:) To prevent old browsers from displaying your JS code, do the following:

  1. Immediately after the opening <script> tag, put a one-line HTML-style
    comment without the closing characters,so that the first two lines of your script
    would look like this:
    <script language="JavaScript">
    <!--
  2. At the end of your script, put the following two lines:
    //-->
    </script>

Thus, your HTML file will contain the following fragment:
<script language="JavaScript">
<!--
Here you put your JS code.
Old browsers will treat it
as an HTML comment.
//-->
</script>

Old browsers will treat your JS code as one long HTML comment. On the other
hand, new JavaScript-aware browsers will normally interpret JS code between the tags<script>and </script> (the first and last lines of your JS code will be treated by
the JavaScript interpreter as one-line comments).

 
If the user's browser cannot execute JavaScript code, can I display a warning for the user?

Ans:)Yes, you can display a special warning for users of JavaScript-incapable
browsers. Put your warning text between the tags <NOSCRIPT> and </NOSCRIPT>.

Here's an example:
<NOSCRIPT>
<H3>This page uses JavaScript</H3>
<ul>
<li>Please use Netscape Navigator 3+ or Internet Explorer 3+
<li>Make sure that JavaScript is enabled in your browser.
</ul>
</NOSCRIPT>

JavaScript-enabled browsers will ignore everything between <NOSCRIPT> and
</NOSCRIPT>. Browsers that cannot execute JavaScript will display your message on
the page.

NOTE: The <NOSCRIPT> tag is not supported by Netscape Navigator 2. Therefore,
your message will be visible to Netscape 2 users even if JavaScript is enabled in
their browser. Keep this in mind and choose a proper wording that won't mislead Netscape 2 users. (For example, the above message assumes that your script requires at least version 3 of the browser.)

 
 
 
 
 
Quick Links
Java FAQ's
XML FAQ's
.Net FAQ's
Javascript FAQ's
 
 
 
 
 
Home  |  Aboutus  |  Post Your Content  |  Tell a Friend  |  Contact us  |  Sitemap
© 2009 365edu. All Rights Reserved. Site by 365edu. Best view in 1024x768 resolution.