Re: [JSMentors] Javascript Timer, Countdown Clock

2011-04-13 Thread Daniel Nyström
Maybe this could be to any help; http://jsfiddle.net/speakman/8GX7J/ If you "calibrate" against the server, you could use the client clock to make it pretty accurate. / D 2011/4/1 Hans Peter : > Hi, > im trying to build a accurate countdown clock. are there any best > practices you could recomme

[JSMentors] simple question

2011-04-13 Thread emaildevml
Hello, I start to learn JS. ** var f1 = function () { this.v1 = 5; } f1.prototype.get_v1 = function () { return this.v1; }; var f2 = new f1(); f1.v1 // return nothing f1.get_v1() // nothing f2.v1 // return 5 f2.get_v1() // return 5 ** Why f

[JSMentors] Just how efficient are JS function calls?

2011-04-13 Thread Rob Steward
Hi all, short time lurker and first time poster. I just started writing a new tools library, and one of the methods is some syntactic sugar that allows you to manipulate the DOM and include a javascript file in the head element. [code] function include(files) { var head = document.getElem

[JSMentors] simple question

2011-04-13 Thread emaildevml
Hello, I start to learn JS. ** var f1 = function () { this.v1 = 5; } f1.prototype.get_v1 = function () { return this.v1; }; var f2 = new f1(); f1.v1 // return nothing f1.get_v1() // nothing f2.v1 // return 5 f2.get_v1() // return 5 ** Why f

Re: [JSMentors] Re: Bad Coercion Advice from a Guru (or why you should question everything)

2011-04-13 Thread Asen Bozhilov
J.R.: > Instead of: > if (window.ActiveXObject) { > > We should use: > if (typeof window.ActiveXObject !== "undefined") { I would not use both approaches. I would use: if (typeof ActiveXObject != 'undefined') { //... } Or as Diego proposed: if ('ActiveXObject' in this) { //... } When

Re: [JSMentors] Re: Bad Coercion Advice from a Guru (or why you should question everything)

2011-04-13 Thread Diego Perini
On Wed, Apr 13, 2011 at 11:55 PM, J.R. wrote: > On Tuesday, 12 April 2011 02:12:31 UTC-3, Angus Croll wrote: >> >> Douglas Crockford is a JavaScript hero and a great communicator. I learned >> a lot from his writings and his excellent video series >> (http://net.tutsplus.com/tutorials/javascript-a

Re: [JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Poetro
2011/4/13 Scott Sauyet : > Poetro wrote: >>     win = window.open('javascript:"' + encodeURIComponent(message) + >> '"', yourwindow), >>     doc = window.document; > > presumably `doc = win.document`, right? Ah yes, tnx for finding the typo. -- Poetro -- To view archived discussions from the o

Re: [JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Diego Perini
I would first say that support for the "javascript:" protocol is pretty strong in older browsers. However, if feasible and for browsers were it is supported, I would suggest to use a "data:" URI as in: window.open('data:text/html,') instead of the "javascript:" protocol. I haven't tested on I

[JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Scott Sauyet
Poetro wrote: >     win = window.open('javascript:"' + encodeURIComponent(message) + > '"', yourwindow), >     doc = window.document; presumably `doc = win.document`, right? -- Scott -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmento

Re: [JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Poetro
2011/4/13 Sean Kinsey : > If there is an existing window open with the same name as referenced in the > `window.open(url, name)` statement, then this window will normally be > targeted instead of opening a new one (and having it blocked). > This has lead me do the following; identify the name used

[JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Sean Kinsey
On Tuesday, April 12, 2011 7:37:44 PM UTC+2, cancelbubble wrote: > > Here at work, we do a fair bit of surveys on various sites via Survey > Monkey. The MO has always been to do a pop *under *window - focus the > parent, not the child/new window. I've stressed how I think this is slimey > (hi