FAQ . . . comp.lang.javascript . . . Version 6.21 - 2000/7/20 C O M P . L A N G . J A V A S C R I P T M E T A - F A Q _________________________________________________________________ T A B L E O F C O N T E N T S ================================= 1 meta-FAQ meta-questions 2 comp.lang.javascript tips 2.1 Which newsgroup deals with javascript? 2.2 What questions are off-topic for clj? 2.3 Why did I get flamed when I posted to clj? What do I have to do before posting to clj? 2.4 Why was my post not answered? 2.5 How do I direct someone to this FAQ? 2.6 What is ECMAScript? JScript? 2.7 What are object models? 2.8 What is the document object model? 2.9 I have a question that is not answered in here or in any of the resources mentioned here but I'm sure it has been answered in clj. Where are the clj archives located? 3 javascript resources 3.1 What books cover javascript? 3.2 What online resources are available? 3.3 Is there a javascript games site? 4 Quick Answers 4.1 How do I protect my javascript code/disable right mouse button? 4.2 How can I disable the back button in a web browser? 4.3 How can I access the client-side filesystem? 4.4 How can I see in javascript if a web browser accepts cookies? 4.5 How can I protect a webpage in javascript? 4.6 How do I format 6.57634 to 6.58? 4.7 Why does 5 * 1.015 != 5.075? 5 Comments _________________________________________________________________ 1.0 meta-FAQ meta-questions =========================== You are reading the __ comp.lang.javascript __ meta-FAQ, version 6.20 This is the official __ comp.lang.javascript __ (clj) FAQ. Or, more accurately, the meta-FAQ as it mainly provides URLs to further information about javascript and some hints and tips to make your stay in comp.lang.javascript more enjoyable. This document is not intended as a javascript tutorial or reference guide. There is already plenty of this sort of information on the web. This document was created to help reduce the high levels of noise on clj and to provide a resource for people new to javascript or who want to know locations of valuable javascript resources. If you have a question you feel should be answered in the meta-FAQ, a correction for information included in this document, or wish to note a URL not included herein, please email the meta-FAQ maintainer, Jim Ley, at __ Jim@jibbering.com __ The FAQ will currently be posted on Monday, Wednesday and Friday, until such a time as the regulars feel it can be posted less frequently. It is also available on the web at 2.0 comp.lang.javascript tips ============================= 2.1 Which newsgroup deals with javascript? __ comp.lang.javascript __ is the official Usenet newsgroup dealing with javascript. There are other newsgroups but many of them are not carried by most news feeds. clj is an unmoderated newsgroup. 2.2 What questions are off-topic for clj? clj deals with ECMAScript languages, so any questions about JavaScript or JScript are welcome - however the group has a majority of questions about using javascript in a browser, please make it obvious which host you are using javascript in. Javascript and Java are two completely different languages. Java questions should be asked in one of the comp.lang.java.* newsgroups; they are not appropriate for clj. Questions dealing with other scripting languages, such as VBScript, PerlScript or CGI scripting are also off-topic, as are HTML-only questions. 2.3 Why did I get flamed when I posted to clj? What do I have to do before posting to clj? Before posting to clj, you should thoroughly read this document. You should also thoroughly read the resources mentioned in section 3. Read FYI28/RFC1855, on Usenet and you should read all appropriate posts to the clj newsgroup for several days. Most questions come up at least once every other day and people get sick of answering them repeatedly. Please state your question as clearly and concisely as possible, as this will make it far easier for the other readers of the list to understand your problems and suggest possible solutions. Use the Subject: of your post to indicate the type of problem you have. 'Help!' or 'I hate Microsoft!' are not nearly as useful to contributors who do not read every post as 'Missing frames' or 'Image map fails in NN4' etc... Has the same question already been posted that day? It is okay to ask again with your particular information, but indicate that you have seen the previous question and tell how yours differs. Include the script you have been working on (or URL) - indicate the problem spots and/or previous attempts. Try to limit the length of your post by removing extraneous page elements, but avoid removing script unless you are sure it is not an issue, if the script is long though, please do not post the full script and just provide a link, as a guide more than 500 lines for a post is not normally a good idea in any circumstances. A mention of which platforms and browsers in use or giving problems will also help. Post in plain-text only. Do not post using HTML. If you have to include your script, paste it in to your post in plain-text, do not uuencode it or attach it using mime. There is good reason for this request. Many newsreaders do not read html or mime, and this limits the number of people who could help you. Before a reply, quote only the minimum that needs to be quoted. Don't ask, or at least expect, to be emailed individually. Some individuals run scams for the purpose of collecting active email addresses and many won't risk being victimized. If you have circumstances that won't allow you to read clj for the follow-up, explain what they are and ask to be CC'ed a copy. You also might try one of the sites listed in section 3 to read any follow-ups. Don't take flames too seriously. And don't start a thread complaining about rude or flippant responses, there is already enough noise in clj. Keep a sense of humour while posting and reading and everything will be a lot more enjoyable. Remember that it is *not* the *job* of posters here to help you. That the majority of regular posters here do so *voluntarily* in their free time. They have good days and bad days just like everyone else. clj is a technical group, postings of job adverts and commercial adverts are not welcome - job postings should go to an appropriate regional jobs group. Annoucements of products of particular revelance to javascript are welcome, but not more often than once per major release - then post a short link to your products webpage. 2.4 Why was my post not answered? This could be for several reasons: it was a variation of a frequently asked question and was therefore ignored by everyone no one knows the answer the person with the answer has not seen the post it might not be possible to do what you want to do but perhaps readers of clj are reluctant to answer your post in the negative when they are not convinced that it cannot be done. 2.5 How do I direct someone to this FAQ? This document is posted to clj very frequently. There should be no reason to direct someone to it. However, if someone asks a question answered in this FAQ or in one of the resources listed herein, please let them know their question is answered in the FAQ and that the FAQ can be found at 2.6a What is ECMAScript? ECMAScript is the international standard for javascript. JScript 3.0 and JavaScript 1.2 (available with version 4. browsers) are more or less ECMAScript compliant. Note that ECMAScript did not attempt to standardize the document object model. The current edition is Edition 3.0, There is some support for this edition in JScript 5.0 and JavaScript 1.3, JScript 5.5 is fully compliant and JavaScript 1.5 should be fully compliant when it is released, a beta version is available. 2.6b What is JScript? JScript is Microsoft's implementation of ECMAScript. 2.7 What are object models? Object models (OMs) are not part of the javascript language, they are provided by the host to allow javascript (or other scripting language) to communicate with the host. An object model may allow a javascript to access a file system, or control a nuclear power station. The most commonly used object models via javascript are provided by Active Server Pages, Server Side JavaScript, and the Windows Script Host. The most common of all of course is the Document Object Model (DOM) provided by web browsers. 2.8 What is the Document Object Model? This is the collection of objects provided by each browser. Basically, any object in the window hierarchy is part of the DOM. This means that document.writeln(), for example, is not a javascript method but is, in fact, a method provided by the DOM. The DOM has been standardised by the w3 consortium however like all w3 standards browser support unfortunately is not there yet. Most cross-browser coding problems come from slightly different implementations of the DOM in the different browsers. Level 2 of the DOM standard is already in draft. 2.9 I have a question that is not answered in here ... or in any of the resources mentioned here but I'm sure it has been answered in clj. Where are the clj archives located? Maintain usenet archives going back many years. 3.0 Javascript resources ======================== 3.1 What books cover javascript? There are rather a lot of javascript books available, and if anyone has an example of an up to date good javascript book, I'll gladly add it to the faq. 3.2 What online resources are available? A collection of 100 articles covering javascript. They are currently available for download. This is an exhaustive javascript FAQ and is the reason this document is an meta-FAQ, not a FAQ. More than 90% of questions posted to clj are already answered in the 712 faq's that are held here. Don't post until you read this. This is a steadily growing, searchable javascript knowledge base, compiled by Netscape javascript champion Martin Honnen from posts to comp.lang.javascript and netscape.devs-javascript. The actual documentation from Netscape and Microsoft: Index of docs online and for download: (D)HTML reference: JScript reference: Microsoft's scripting site. Unfortunately, this only covers the most recent version JScript. Archived documentation for MSIE 3.x. the official ECMAScript specification. DOM level 1 ECMA script binding FESI - a free implementation of ECMAScript in Java. archive Usenet newsgroups. frequently asked questions about source code obfuscation, first from 1998 second from 1999 after MS released Microsoft Script Encoder. Sites discussing Active Server Pages. DHTML source code and tutorials to a high standard. Sites focused on using Scripting to automate Windows (TM) Code for manipulating dates in javascript. 3.3 Is there a javascript games site? The site hosts games written entirely with javascript. Most also make heavy use of dHTML. There is a forum for both real-time and message-board type chats. 4.0 Quick Answers ================== 4.1 How do I protect my javascript code/disable right mouse button? In the main you don't, as the language is interpreted, 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. 4.2 How can I disable the back button in a web browser? You can't, the browsers history cannot be modified, you can however use location.replace(url) in some browsers to replace the current page in the history. 4.3 How can I access the client-side filesystem? Security means that by default you can't, in a more restricted enviroment, there are options, (e.g. live connect to Java in NN, and using FileSystemObject in IE) check http://deja.com/usenet for previous posts on the subject. 4.4 How can I see in javascript if a web browser accepts cookies? Writing a cookie, reading it back and checking if it's the same. 4.5 How can I protect a webpage in javascript? You can't security needs to be done serverside, client side protection does not work. 4.6 How do I format 6.57634 to 6.58? In ECMAScript Ed. 3.0 (JScript 5.5) num.toFixed(2) or for previous versions: Math.round(num*100)/100, (doesn't add trailing zeros.) see http://www.aptools.com/javascript/ 4.7 Why does 5 * 1.015 != 5.075? Numbers which are finite in Decimal, maybe recurring in the Binary system used inside javascript, see 4.6 on how to cope with this feature. 5.0 Comments ============= There have been many contributors to this FAQ in its history, thanks to them all for a list see: If you have any suggestions for the FAQ, or further questions that you feel should be answered here, please e-mail me at the address below. ========================= FAQ Maintained by Jim Ley - Jim@Jibbering.com