HighDots Forums  

comp.lang.javascript FAQ - META 2008-10-15

Javascript JavaScript language (comp.lang.javascript)


Discuss comp.lang.javascript FAQ - META 2008-10-15 in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
FAQ server
 
Posts: n/a

Default comp.lang.javascript FAQ - META 2008-10-15 - 10-15-2008 , 04:00 AM






comp.lang.javascript FAQ - Quick Answers- 10, Updated October 11, 2008

1 Meta-FAQ meta-questions

To cope with a desire for additional explanation and detail
relating to some aspects of the FAQ, an additional resource
is available at:-

<URL: http://www.jibbering.com/faq/faq_notes/faq_notes.html >

It has been provided separately to avoid increasing the size of
the FAQ to a point where it would be unreasonable to post it to
the group.
2 Javascript Tips
2.1 Which newsgroups deal with javascript?

CLJ is an unmoderated newsgroup.
2.2 What questions are on-topic for CLJ?

The comp.lang.javascript newsgroup charter is included in
<URL: http://www.jibbering.com/faq/faq_notes/cljs_charter.html > 2.3 What should I do before posting to CLJ?

Announcements of products relevant to javascript are welcome, but not
more often than once per major release, and then post a short
link to the product's 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.

Nobody 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.

The question was not asked clearly enough, or did not included
enough information to be answered.

The questioner did not realise the need to read the group, for a
few days, to see the answers posted there.
You ignored section 2.3

If it is not one of these, then after a few days consider
reposting after checking <URL: http://groups.google.com/group/comp.lang.javascript/topics >
for replies. Make sure the post is phrased well, and everything
needed to answer is correct, and the subject is appropriate.
2.5 What is ECMAScript?

The current edition is ECMA-262, 3rd Edition. There is some
support for this edition in JScript 5.0 and JavaScript 1.3.
JScript 5.5 and JavaScript 1.5, in Netscape 6.1 and later, are
compliant (JavaScript 1.5 in Netscape 6 missed some methods).
2.6 What is JScript?

Questions that are specific to Microsoft's JScript may also
be appropriately asked at:
news:microsoft.public.scripting.jscript 2.7 What are object models?

Object models (OMs) are not part of the ECMAScript language: they
are provided by the host to allow javascript (or other scripting
language) to communicate with the host. An object model may allow
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 is the
Document Object Model (DOM) provided by web browsers. Other
document types such as SVG also define scriptable DOMs, mostly as
extensions of the W3C Core DOM specification designed for use
with XML documents.
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 an
ECMAScript method but is, in fact, a method provided by the DOM.
The DOM has been standardised by the World Wide Web Consortium
(W3C); however, like all W3C standards, browser support is not
yet complete. Most cross-browser coding problems come from
slightly different implementations of the DOM in the different browsers.

<URL: http://jibbering.com/faq/#onlineResources >
<URL: http://www.w3.org/DOM/faq.html >
<URL: http://www.w3.org/DOM/ >

2.9 Internationalisation and Multinationalisation in javascript.

Much more support is expected in future versions of ECMAScript.
2.10 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?
<URL: http://groups.google.com/group/comp.lang.javascript/topics >
Maintain an archive of comp.lang.javascript going back to 1996 and
provide diverse archive searching facilities.
2.11 What does the future hold for ECMAScript?

The fourth edition of ECMAScript will provide new features like
typed variables, and classes. More information can be found at:
<URL: http://www.ecmascript.org/ >,
or from news:microsoft.public.dotnet.languages.jscript 3 Javascript Resources
3.1 What books cover javascript?
_"JavaScript Pocket Reference,"_, By David Flanagan.
ISBN-10: 1565925211, ISBN-13: 978-1565925212

<URL: http://oreilly.com/catalog/9780596004118/toc.html >
<URL: http://oreilly.com/catalog/9780596004118/errata/ >

3.2 What online resources are available?

*Other Sites on Browser Scripting*

* Javascript FAQ site

<URL: http://www.faqts.com/knowledge_base/index.phtml/fid/53/ >

4 Quick Answers: Numbers
4.1 How do I convert a Number into a String with exactly 2 decimal places?
4.2 Why does simple decimal arithmetic give strange results?
4.3 Why does K = parseInt('09') set K to 0?
4.4 Why does 1+1 equal 11? or How do I convert a string to a number?
4.5 How do I generate a random integer from 1 to N?
5 Quick Answers
5.1 How do I protect my javascript code?

With clientside javascript you can't as your code is distributed
in source form and is easily readable. With JScript, there is the
Script Encoder (see MSDN), but this is nothing more than obfuscation.
Disabling the right mouse button also does nothing to protect
your script in a Web browser.

Your code is likely protected under copyright laws. See:

<URL: http://www.wipo.int/about-ip/en/copyright.html >
<URL: http://webdesign.about.com/od/copyright/Copyright_Issues_on_the_Web_Intellectual_Property. htm >

5.2 How can I disable the back button in a web browser?

You can't. The browser's history cannot be modified. However, you
can use location.replace(url); in some browsers to replace
the current page in the history.

<URL: http://msdn2.microsoft.com/en-us/library/ms536712.aspx >
<URL: http://docs.sun.com/source/816-6408-10/location.htm#1194240 >

5.3 How can I access the client-side filesystem?

Security means that by default you can't. In a more restricted
environment, there are options. For example, using LiveConnect
to connect to Java with Netscape, and using the FileSystemObject
in IE. Check Google Groups archives <URL: http://groups.google.com/group/comp.lang.javascript/topics >
for previous posts on the subject.

<URL: http://msdn2.microsoft.com/en-us/library/z9ty6h50.aspx >
<URL: http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html >

5.4 How can I see in javascript if a web browser accepts cookies?

Write a cookie and read it back and check if it's the same.

<URL: http://www.w3schools.com/js/js_cookies.asp >

Additional Notes:

<URL: http://www.jibbering.com/faq/faq_notes/cookies.html >
<URL: http://www.ietf.org/rfc/rfc2965.txt >
<URL: http://www.galasoft-lb.ch/myjavascript/consulting/2001012701/ >
<URL: http://www.cookiecentral.com/ >

5.5 How can I prevent access to a web page by using javascript?

In practice you can't. While you could create a suitable
encryption system with a password in the page, the level of
support you need to do this means it's always simpler to do it
server-side. Anything that "protects" a page
other than the current one is definitely flawed.
5.6 How do I communicate between frames in a web browser?

Note that it is not possible to communicate between frames on
different domains this way.
5.7 How do I find the size of the window?

Note: The dimensions cannot be determined accurately until after
the document has finished loading.

<URL: http://msdn2.microsoft.com/en-us/library/ms533566.aspx >
<URL: http://developer.mozilla.org/en/DOM/window.innerWidth >
<URL: http://dev.opera.com/articles/view/using-capability-detection/ >

5.8 How do I check to see if a child window is open, before opening another?


var myWin;
function openWin(aURL) {
if (!myWin || myWin.closed ) {
myWin = window.open(aURL,'myWin');
} else {
myWin.location = aURL;
myWin.focus();
}
}


<URL: http://msdn2.microsoft.com/en-us/library/ms533574.aspx >
<URL: http://docs.sun.com/source/816-6408-10/window.htm#1201877 >

5.9 Why does framename.print() not print the correct frame in IE?

IE prints the frame that has focus when you call the print
method frameref.focus();frameref.print();
<URL: http://msdn2.microsoft.com/en-us/library/ms976105.aspx >

5.10 How do I get the value of a form control?

Third Exception: File inputs. Most current browsers do not allow
reading of type="file" input elements in a way that is useful.
5.11 How do I close a window and why does it not work on the first one?

Use windowRef.close(), where windowRef is a window object
reference, such as window, top, parent, self, or a reference
obtained from the window.open() method. You can only close
windows opened by scripts, no others.

<URL: http://msdn2.microsoft.com/en-us/library/ms536367.aspx >
<URL: http://docs.sun.com/source/816-6408-10/window.htm#1201822 >
<URL: http://developer.mozilla.org/en/docs/DOM:window.open#FAQ >

5.12 How do I modify the current page in a browser?

Note: Make sure the element exists on the page (and has been parsed) before trying to
reference it.

<URL: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-FF21A306 >
<URL: http://msdn.microsoft.com/en-us/library/cc304097(VS.85).aspx >
<URL: http://msdn2.microsoft.com/en-us/library/ms533897.aspx >
<URL: http://developer.mozilla.org/en/Whitespace_in_the_DOM >
<URL: http://developer.mozilla.org/en/docs/DOM:element.innerHTML >
<URL: http://www.jibbering.com/faq/faq_notes/alt_dynwrite.html >

5.13 How do I trim whitespace?

Using Regular Expressions (JavaScript 1.2/JScript 3+) :


function trimString(s) {
return s.replace(/^\s+|\s+$/g,'');
}



<URL: http://docs.sun.com/source/816-6408-10/regexp.htm >
<URL: http://msdn2.microsoft.com/en-us/library/6wzad2b2.aspx >
<URL: http://en.wikipedia.org/wiki/Regular_expression >
<URL: http://www.merlyn.demon.co.uk/js-valid.htm >

5.14 How do I force a reload from the server/prevent caching?

To reload a page, use location.reload(). However, this depends
upon the cache headers that your server sends. To change this,
you need to alter the server configuration. A quick fix on the
client is to change the page URI so that it contains a unique
element, such as the current time. For example:
location.replace(location.href+'?d='+new Date().valueOf())
If the location.href already contains a query String, use:
location.replace(location.href+'&d='+new Date().valueOf())
<URL: http://www.mnot.net/cache_docs/ >
<URL: http://docs.sun.com/source/816-6408-10/date.htm >

5.15 How do I get a perl/asp/php variable into client-side javascript?

Use the server-side language to generate the javascript:


var jsvar = "<%= aspvar %>";
var jsvar = "<?php echo $phpvar ?>";

5.16 Why do I get permission denied when accessing a frame/window?

In the normal browser security model, it is impossible for a
script from one domain to access the properties of pages served
from another domain, or a different protocol. Any attempt to
access a property in such cases will result in a "Permission
Denied" error. Signed scripts or trusted ActiveX objects can
overcome this in limited situations.

<URL: http://msdn2.microsoft.com/en-us/library/ms533028.aspx >

5.17 How do I make a 10 second delay?

Other (less event driven) hosts have different wait functions,
such as WScript.Sleep() in the Windows Script Host.

<URL: http://msdn2.microsoft.com/en-us/library/ms536753.aspx >
<URL: http://docs.sun.com/source/816-6408-10/window.htm#1203758 >
<URL: http://en.wikipedia.org/wiki/Event-driven_programming >

5.18 How do I change print settings with window.print()?

In a normal security environment, you can't change anything. The
page stylesheet rules provide some options, but are not supported
in browsers yet. If you can, use an ActiveX or Plugin ScriptX and
Neptune from Meadroid to give you more control for Windows
versions of Internet Explorer, Netscape, and Opera.

<URL: http://www.meadroid.com/scriptx/ >
<URL: http://msdn2.microsoft.com/en-us/library/ms976105.aspx >

5.19 I have <a href="javascript:somefunction()"> what ... ?

Instead, use
<a href="something.html" onclick="somefunction();return false">
where something.html is a meaningful alternative. Alternatively,
attach the click callback using an event registry.

<URL: http://www.useit.com/alertbox/20021223.html >

5.20 My element is named myselect[], how do I access it?

Form controls with any "illegal" characters can be accessed with
formref.elements["myselect[]"] - The bracket characters,
amongst others, are illegal in ID attributes and javascript
identifiers, so you should try to avoid them as browsers may
handle them incorrectly.

<URL: http://msdn2.microsoft.com/en-us/library/ms537449.aspx >
<URL: http://docs.sun.com/source/816-6408-10/form.htm >
<URL: http://www.jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_25 >

5.21 How do I detect Opera/Netscape/IE?

Object/feature detection means checking that the object you wish
to use is supported by the browser before using it. This means
that you don't need to know what browsers support what methods,
and your code will automatically be usable on any browser that
can execute it.


if (document.getElementById &&
document.getElementById('el') &&
document.getElementById('el').style ) {
// We know that this browser supports getElementByID and has
// a style object, so we can set a style property.
document.getElementById('el').style.color = "red";
}


Browser bugs can often be detected and overcome in similar ways.

<URL: http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pageseveloping_C ross_Browser/Cross_Platform_Pages >
<URL: http://www.jibbering.com/faq/faq_notes/not_browser_detect.html >
<URL: http://dev.opera.com/articles/view/using-capability-detection/ >
<URL: http://developer.apple.com/internet/webcontent/objectdetection.html >

5.22 How do I disable the right mouse button?

The oncontextmenu is a proprietary method and is not supported on
all browsers.
<body oncontextmenu="return false"> 5.23 How do I change the confirm box to say yes/no or default to cancel?

The buttons on a confirm box cannot be changed, nor can you
specify a default button. However, you should be able to change
the question so that "OK" is suitable as the default.
e.g. change "We will now buy ourselves a Porsche with your credit
card, Do you want to continue with this transaction _OK_ Cancel"
to "We will now buy ourselves a Porsche with your credit card,
Would you like to abandon this transaction? _OK_ Cancel"
5.24 How do I log-out a user when they leave my site?

This cannot be done reliably. Here's why:


The user may disable javascript so the log-out script will
never execute.

The user may not be on-line when they close your web page.

Javascript errors elsewhere in the page may prevent the script
executing.

The browser may not support the onunload event, or may not fire
it under certain circumstances, so the log-out function will
not execute.


The URL below has more information.

<URL: http://groups.google.com/groups?selm=BlmZ7.55691%244x4.7344316%40news2-win.server.ntlworld.com >

5.25 How do I format the lastModified date with javascript?

Apparently, new Date() reads document.lastModified
correctly, though problems
can occur if the browser returns only two digits for the year.
In particular, time offset, field order and separators may vary.
It is also reliant on the server's clock having been correctly
set at the time of upload. See the URL
below.

<URL: http://www.merlyn.demon.co.uk/js-date2.htm#lM >

5.26 Why are my rollovers so slow?

Images are cached by the browser depending on the headers sent by
the server. If the server does not send sufficient information
for the browser to decide the image is cacheable, the browser
will check if the image has been updated every time you change the
src of an image (in some user settings). To overcome this you
must send suitable headers.

<URL: http://www.mnot.net/cache_docs/ >

5.27 How do I change the text in the url/location bar?

This text can only be altered by changing the URL of the page.
5.28 How do I prompt a "Save As" dialog for an accepted mime type?

Some browsers accept the Content-Disposition header, but this
must be added by the server. Taking the form:-
Content-Disposition: attachment; filename=filename.ext
<URL: http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html >
<URL: http://support.microsoft.com/kb/q260519/ >

5.29 How do I run a server side script?

Mozilla, Opera 7.6+, Safari 1.2+, and Windows IE 7
provide the XMLHttpRequest object
(Windows IE versions 5+, provides ActiveX to acheive an analagous
effect). XMLHttpRequest can send HTTP requests to
the server, and provides access the responseText or responseXML
(when the response is XML), and HTTP header information.

<URL: http://jibbering.com/2002/4/httprequest.html >
<URL: http://www.w3.org/TR/XMLHttpRequest/ >
<URL: http://developer.mozilla.org/en/XMLHttpRequest >
<URL: http://msdn.microsoft.com/en-us/library/ms537505(VS.85).aspx >

5.30 I have window.status="Moomin"; why doesn't the statusbar change?

When changing the status in an event (e.g. onmouseover) you
should return true from the event. Also a number of browsers
require a short delay before setting the status to overcome their
default behaviour with the statusbar.
onevent="setTimeout('window.status=\'Moomin\'',15) ;"
Most browsers are configured, by default, to disallow scripts from setting
the status bar text.
5.31 How do I modify the current browser window?

In a default security environment you are very limited in how much
you can modify the current browser window. You can use
window.resizeTo or window.moveTo to resize or move a
window respectively, but that is it. Normally you can only
suggest chrome changes in a window.open
<URL: http://msdn2.microsoft.com/en-us/library/ms536651.aspx >
<URL: http://developer.mozilla.org/en/docs/DOM:window.open >

5.32 How do I POST a form to a new window?

Use the target attribute on the form, opening a window with
that name and your feature string in the onsubmit handler of the
FORM.


<form action="..." target="wndname" onsubmit="window.open('',this.target,'features');r eturn true;">


<URL: http://www.htmlhelp.com/reference/html40/forms/form.html >

5.33 How do I download a page to a variable?

Within a web-page use the XMLHttpRequest object, see:

<URL: http://jibbering.com/2002/4/httprequest.html >
<URL: http://www.ajaxtoolbox.com/ >

5.34 How do I access a property of an object using a string?

There are two ways to access properties: the dot notation and
the square bracket notation. What you are looking for is the square
bracket notation in which the dot, and the identifier to its right,
are replaced with a set of square brackets containing a string. The
value of the string matches the identifier. For example:-


//dot notation
var bodyElement = document.body;

//square bracket notation, using an expression
var bodyElement = document["bo"+"dy"];


<URL: http://www.jibbering.com/faq/faq_notes/square_brackets.html >

5.35 When should I use eval?

The eval() function should _only_ be used when it is necessary to
evaluate a string supplied or composed at run-time; the string
can be anything from a simple (but unpredictable) expression such
as "12 * 2.54" to a substantial piece of javascript code.
5.36 Why doesn't the global variable "divId" always refer to the element with id="divId"?

Microsoft introduced a shortcut that can be used to reference
elements which include an id attribute where the
id becomes a globally-accessible property. Some browsers reproduce
this behavior. Some, most notably Gecko-based browsers (Netscape and Mozilla),
do so only in "quirks" mode. The best approach is the document.getElementById
method, which is part of the W3C DOM standard and implemented
in modern browsers (including IE from version 5.0). So an
element with id="foo" can be referenced
with:-


var el = document.getElementById("foo");



Note: make sure not to use the same id twice in the same document
and do not give an element a name that matches an id
of another in the same document or it will trigger bugs in MSIE <= 7 with
document.getElementsByName and document.getElementById.

<URL: http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages:Using_the_W3 C_DOM#Accessing_Elements_with_the_W3C_DOM >
<URL: http://www.jibbering.com/faq/faq_notes/faq_notes.html#FAQN4_41 >

5.37 How do I open a new window with javascript?

New windows can be opened on browsers that support the
window.open function and are not subject to the action of any
pop-up blocking mechanism with code such as:-


var wRef;
if(window.open){
wRef = window.open("http://example.com/page.html","windowName");
}


<URL: http://developer.mozilla.org/en/docs/DOM:window.open >
<URL: http://www.infimum.dk/HTML/JSwindows.html >

5.38 How do I get my browser to report javascript errors?

* Windows IE

Wait until a little yellow
triangle appears at the left end of the status bar, double click
on it and, when the error dialog box appears, check the "Always
show errors" checkbox it contains.

Or, Internet Options, Advanced, deselect "Disable Script Debugging",
select "Display a notification ...".


* Firefox
<URL: http://www.getfirebug.com/ >.


* Opera

Tools > Advanced > Error console


<URL: http://dev.opera.com/articles/view/introduction-to-opera-dragonfly/ >

* Safari
<URL: http://developer.apple.com/internet/safari/faq.html#anchor14 >

* Chrome

JavaScript Console: click the Page menu icon and select
Developer > JavaScript Console. From here, you'll be
able to view errors in the JavaScript execution, and enter
additional javascript commands to execute.



JavaScript Debugger: available as Page menu icon > Developer
Quote:
Debug JavaScript, the debugger provides a command prompt from which you
can set breakpoints, backtrace, and more. Type help at the debugger
command line to get started.


<URL: http://www.google.com/chrome/intl/en/webmasters-faq.html#jsexec >

* Mac IE

Use the Preferences dialog.


5.39 What is Ajax?
Ajax
is shorthand for Asynchronous JavaScript And XML. The technology is
based on the XMLHttpRequest Object.
At its simplest, it is the sending/retrieving of new data from the server
without changing URL's or reloading the current page.

Mozilla Documentation:

<URL: http://developer.mozilla.org/en/docs/XMLHttpRequest >

MSDN Documention:

<URL: http://msdn2.microsoft.com/en-us/library/ms535874.aspx >
<URL: http://msdn2.microsoft.com/en-us/library/ms759148.aspx >

Libraries and Tutorial Sites:

<URL: http://jibbering.com/2002/4/httprequest.html >
<URL: http://www.ajaxtoolbox.com/ >


An alternative to the XMLHttpRequest Object is Remote Scripting:

<URL: http://www.ashleyit.com/rs/main.htm >

5.40 Why is my Ajax page not updated properly when using an HTTP GET request in Internet Explorer?

Microsoft Internet Explorer caches the results of HTTP GET requests. To ensure that the
document is retrieved from the server, you will need to use the POST Method.

<URL: http://msdn2.microsoft.com/en-us/library/ms536648.aspx >

6 Comments and Suggestions
6.1 Why do some posts have <FAQENTRY> in them?

The <FAQENTRY> should not be used in posts except in
conjunction with a suggestion/proposal for the FAQ. It should
also not be literally quoted in replies, instead it should be
partly obscured as, e.g. <FAQ**TRY> or similar.
6.2 How do I make a suggestion?

To make a suggestion to the FAQ, use either the FAQENTRY method
above, or email Garrett Smith dhtmlkitchen@gmail.com (current FAQ editor)
or Jim Ley (jim.ley@gmail.com). All comments, suggestions, and
especially corrections are welcome.



1 Meta-FAQ meta-questions


2 Javascript Tips
2.1 Which newsgroups deal with javascript?
2.2 What questions are on-topic for CLJ?
2.3 What should I do before posting to CLJ?
2.4 Why was my post not answered?
2.5 What is ECMAScript?
2.6 What is JScript?
2.7 What are object models?
2.8 What is the document object model?
2.9 Internationalisation and Multinationalisation in javascript.
2.10 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?
2.11 What does the future hold for ECMAScript?


3 Javascript Resources
3.1 What books cover javascript?
3.2 What online resources are available?


4 Quick Answers: Numbers

see <URL: http://jibbering.com/faq/#FAQ4 >
Or Wednesdays FAQ posting.

5 Quick Answers
5.1 How do I protect my javascript code?
5.2 How can I disable the back button in a web browser?
5.3 How can I access the client-side filesystem?
5.4 How can I see in javascript if a web browser accepts cookies?
5.5 How can I prevent access to a web page by using javascript?
5.6 How do I communicate between frames in a web browser?
5.7 How do I find the size of the window?
5.8 How do I check to see if a child window is open, before opening another?
5.9 Why does framename.print() not print the correct frame in IE?
5.10 How do I get the value of a form control?
5.11 How do I close a window and why does it not work on the first one?
5.12 How do I modify the current page in a browser?
5.13 How do I trim whitespace?
5.14 How do I force a reload from the server/prevent caching?
5.15 How do I get a perl/asp/php variable into client-side javascript?
5.16 Why do I get permission denied when accessing a frame/window?
5.17 How do I make a 10 second delay?
5.18 How do I change print settings with window.print()?
5.19 I have <a href="javascript:somefunction()"> what ... ?
5.20 My element is named myselect[], how do I access it?
5.21 How do I detect Opera/Netscape/IE?
5.22 How do I disable the right mouse button?
5.23 How do I change the confirm box to say yes/no or default to cancel?
5.24 How do I log-out a user when they leave my site?
5.25 How do I format the lastModified date with javascript?
5.26 Why are my rollovers so slow?
5.27 How do I change the text in the url/location bar?
5.28 How do I prompt a "Save As" dialog for an accepted mime type?
5.29 How do I run a server side script?
5.30 I have window.status="Moomin"; why doesn't the statusbar change?
5.31 How do I modify the current browser window?
5.32 How do I POST a form to a new window?
5.33 How do I download a page to a variable?
5.34 How do I access a property of an object using a string?
5.35 When should I use eval?
5.36 Why doesn't the global variable "divId" always refer to the element with id="divId"?
5.37 How do I open a new window with javascript?
5.38 How do I get my browser to report javascript errors?
5.39 What is Ajax?
5.40 Why is my Ajax page not updated properly when using an HTTP GET request in Internet Explorer?


6 Comments and Suggestions
6.1 Why do some posts have <FAQENTRY> in them?
6.2 How do I make a suggestion?




Reply With Quote
  #2  
Old   
Dr J R Stockton
 
Posts: n/a

Default Re: comp.lang.javascript FAQ - META 2008-10-15 - 10-17-2008 , 06:34 PM






On Oct 15, 9:00*am, "FAQ server" <javascr... (AT) dotinternet (DOT) be> wrote:
Quote:
comp.lang.javascript FAQ - Quick Answers- 10, Updated October 11, 2008
Bart's code needs a tweak; it picked up Section 5 in this thread. It
might be easier to move the present Section 6 into Section 1 & 2 as
below, replacing it with "<HR>" or "END". Then the Dividing Line
would not be affected by subdivision of the "coding" parts.

I think Section 2 should be split, after the current 2.4.

1 Meta-FAQ meta-questions
1.1 How do I make a suggestion? // was 6.2
2 Using Javascript News // NB : numbers change

2.1 What is a newsgroup?
Quote:
*2.2 Which newsgroups deal with javascript?
*2.3 What questions are on-topic for CLJ?
2.4 What should I do before posting to CLJ?
*2.5 Why was my post not answered?
2.6 I have a question that is not answered in here or ... // ??
2.7 Why do some posts have <FAQENTRY> in them? // was 6.1
3 About Scripting
Quote:
* 3.1 What is ECMAScript?
*3.2 What is JScript?
3.3 What are object models?
*3.4 What is the document object model?
3.5 What does the future hold for ECMAScript?
*3.6 Internationalisation and Multinationalisation in javascript.

4 Javascript Resources
...
For 2.1, first draft :

Ordinary Usenet newsgroups, such as CLJ, are distributed media with no
central source or editing; they should be accessed by newsreader
software. Web interfaces, frequently inadequately designed, have
appeared. Usenet groups should not be confused with Google's own
centralised groups, where the user interface looks quite different;
nor confused with other Web-based forums, mailing lists, etc. To
learn about Usenet groups, read FYI28/RFC1855.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ....|


Reply With Quote
  #3  
Old   
Bart Van der Donck
 
Posts: n/a

Default Re: comp.lang.javascript FAQ - META 2008-10-15 - 10-18-2008 , 05:31 AM



Dr J R Stockton wrote:

Quote:
On Oct 15, 9:00*am, "FAQ server" <javascr... (AT) dotinternet (DOT) be> wrote:

comp.lang.javascript FAQ - Quick Answers- 10, Updated October 11, 2008

Bart's code needs a tweak; it picked up Section 5 in this thread.
Section 5 is not handled in regard to the daily posts, but the weekly
Wednesday post (with subject "comp.lang.javascript FAQ - META") does.
This is because the Wednesday post uses the exact content of
http://jibbering.com/faq/index.wen.txt.

It may be possible to regexp this file. The structure goes like this:
(1) content until "6 Comments and Suggestions"
(2) entries of 6
(3) TOC 1-5
(4) TOC of 6

But I think it's not recommended to regex on such unclear stuff. It is
an unstructured text file; not an unambiguous hierarchy that can be
easily and reliably divided (like the XML for the daily posts). The
only way for a regular expression is to split on the strings "6
Comments and Suggestions" (between (1) and (2)), "1 Meta-FAQ meta-
questions" (between (2) and (3)) and again "6 Comments and
Suggestions" (between (3) and (4)). I think it would be better to
alter the content of index.wen.txt in stead of doing such rather
dangerous operations.

--
Bart


Reply With Quote
  #4  
Old   
dhtml
 
Posts: n/a

Default Re: comp.lang.javascript FAQ - META 2008-10-15 - 10-18-2008 , 04:11 PM



Bart Van der Donck wrote:
Quote:
Dr J R Stockton wrote:

On Oct 15, 9:00 am, "FAQ server" <javascr... (AT) dotinternet (DOT) be> wrote:

comp.lang.javascript FAQ - Quick Answers- 10, Updated October 11, 2008
Bart's code needs a tweak; it picked up Section 5 in this thread.

Section 5 is not handled in regard to the daily posts, but the weekly
Wednesday post (with subject "comp.lang.javascript FAQ - META") does.
This is because the Wednesday post uses the exact content of
http://jibbering.com/faq/index.wen.txt.

It may be possible to regexp this file. The structure goes like this:
(1) content until "6 Comments and Suggestions"
(2) entries of 6
(3) TOC 1-5
(4) TOC of 6

But I think it's not recommended to regex on such unclear stuff.
I agree. Especially since the sections may likely change in the future.

It's a safer to break it up into smaller files.

Creating a text file based on one FAQ is now much easier.

Here's the one for Monday:-

Quote:
script language="JScript"
createTextFile('mon', showToday);

function showToday(i) {
return i == 3 || i == 4;
}
/script

To create a Thursday file, I could use:

Quote:
script language="JScript"
createTextFile('thu', showToday);

function showToday(i) {
return i == 6;
}
/script


Garrett

Quote:
--
Bart

--
comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.