Your full service technology partner! 
-Collapse +Expand
Search JavaScript Group:

-Collapse +Expand JavaScript Store

Prestwood eMagazine

September Edition
Subscribe now! It's Free!
Enter your email:

   ► KBJavaScript Knowledge Base  Print This    All Groups  

JavaScript FAQ Page

These FAQs are contributed by you (our online community members). They are organized by our knowledge base topics. Specifically, by the JavaScript sub-topics.

Contribute a FAQ
Expand All

6 JavaScript and AJAX FAQs

Group: JavaScript and AJAX

Topic: Beginners Corner

-Collapse +Expand Q1. How do you close a browser in a link?
Answer: You can do close a browser using JavaScript. Here is an example:


Posted By Mike Prestwood, Post #100907, KB Topic: Beginners Corner
-Collapse +Expand Q2. How do I protect my javascript code?
Answer: In the main you don't, as the language is ran from source, you need to deliver the source code, with JScript, there is the Script Encoder (see MSDN) but this is nothing more than obfuscation in effect, disabling the Right Mouse button, also achieves nothing to protect your script in a web browser. Your code is likely protected under copyright laws.
Posted By Mike Prestwood, Post #100905, KB Topic: Beginners Corner
-Collapse +Expand Q3. What is JavaScript?
Answer: JavaScript is a platform-independent, event-driven, interpreted programming language developed by Netscape Communications Corp. and Sun Microsystems. Originally called LiveScript (and still called LiveWireTM by Netscape in its compiled, server-side incarnation), JavaScript is affiliated with Sun's object-oriented programming language JavaTM primarily as a marketing convenience. They interoperate well but are technically, functionally and behaviorally very different.

JavaScript is useful for adding interactivity to the World Wide Web because scripts can be embedded in HTML files (i.e., web pages) simply by enclosing code in a tag pair. All modern browsers can interpret JavaScript -- albeit with some irritating caveats. (More about them below.)

In practice, JavaScript is a fairly universal extension to HTML that can enhance the user experience through event handling and client-side execution, while extending a web developer's control over the client's browser. And that's worth a FAQ.

Posted By Mike Prestwood, Post #100902, KB Topic: Beginners Corner

Topic: JavaScript and AJAX

-Collapse +Expand Q4. How do you specify the browser size of a window in a link?
Answer: You can do this using JavaScript. Here is an example:

javascript:MM_openBrWindow('', 'compare', 'scrollbars=no, resizable=no, width=600, height=420')

Posted By Mike Prestwood, Post #100906, KB Topic: JavaScript and AJAX
-Collapse +Expand Q5. How is JavaScript syntax like C / C++?
Answer: The languages have enough in common to make learning one easy if you know the other. By the same token, the differences are subtle enough to trip up those proficient in both. Here's a short list comparing C and JavaScript:
  • Terminating JavaScript command lines in semicolons is optional; in C it's mandatory. Recommended practice is to use them religiously in both languages (and Java as well).
  • Both JavaScript and C are case-sensitive; 'doThis' is different from 'DOTHIS'. Experienced programmers learn to love this feature, which drives beginners nuts.
  • Both JavaScript and C are block-structured computer languages and employ curly brackets -- '{' and '}' -- to delimit blocks.
  • Both JavaScript and C employ quotation -- enclosure in single or double quote marks -- to designate text strings.
  • Arrays in both JavaScript and C are zero-based; the first element is myArray[0], not myArray[1].
  • Both JavaScript and C employ '==' for comparison, '=' for equality, and '!' for negation. In fact the set of JavaScript operators is essentially borrowed from C (right down to the deprecated ternary construct a ? b : c).
  • Both JavaScript and C employ the symbols /* to designate a comment */. JavaScript also permits the use of '//' for short comments, as in C++.

Finally, JavaScript's statements are a strict subset of C++'s, offering a smaller selection of identical looping and conditional constructs.

Posted By Mike Prestwood, Post #100904, KB Topic: JavaScript and AJAX
-Collapse +Expand Q6. How do you pass values from ASP to Javascript in the same page?

The same way you do with HTML. Here is a simple example:

Dim MyName
MyName = "Mike Prestwood"
<script language="javascript">
document.write('Hi <%=MyName%>')
Posted By Mike Prestwood, Post #100796, KB Topic: JavaScript and AJAX
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2020 Prestwood IT Solutions.   [Security & Privacy]