473,659 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mozilla and setInterval

Is some future Mozilla going to support setInterval ( <function:funct ion>,
<interval:numbe r> ) ?
Right now it seems to be simply setInterval ( <function-text:string>,
<interval:numbe r> )

--
Richard A. DeVenezia
Jul 20 '05 #1
5 8884
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> wrote in message
news:bj******** ****@ID-168040.news.uni-berlin.de...
Is some future Mozilla going to support setInterval
( <function:funct ion>, <interval:numbe r> ) ?
Right now it seems to be simply setInterval
( <function-text:string>, <interval:numbe r> )


Mozilla does support passing a function reference as the first argument
to both setTimeout and setInterval.

A compatibility trick with setTimeout and setInterval is to use
exclusively function references and provide the function referred to
with its own toString method that returns a string of JavaScript source
code that would call the function via some global identifier. If the
setTimout/Interval function implementation does not support function
reference arguments it type-converts the function into the expected
string by calling its toString method. Allowing the more efficient
function references to be used where supported and providing a fallback
when unsupported. (I have posted a number of examples over the last 3 or
4 months so groups.google.c om search comp.lang.javas cript for my posts
(and some of Yep's) with the keyword setTimeout (and possibly toString)
to see example code).

Richard.
Jul 20 '05 #2
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> writes:
Is some future Mozilla going to support setInterval ( <function:funct ion>,
<interval:numbe r> ) ?
Right now it seems to be simply setInterval ( <function-text:string>,
<interval:numbe r> )


It works fine with a function.

Just try
setInterval(fun ction(){alert(" foo");},2000);
(and be ready to close the window in one of the breaks).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Hi,

Lasse Reichstein Nielsen wrote:
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> writes:

Is some future Mozilla going to support setInterval ( <function:funct ion>,
<interval:num ber> ) ?
Right now it seems to be simply setInterval ( <function-text:string>,
<interval:num ber> )

It works fine with a function.

Just try
setInterval(fun ction(){alert(" foo");},2000);
(and be ready to close the window in one of the breaks).

/L


Why not make it more challenging?
setInterval(fun ction(){alert(" foo");},20);

;-)

--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #4
"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:65******** **@hotpop.com.. .
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> writes:
Is some future Mozilla going to support setInterval ( <function:funct ion>, <interval:numbe r> ) ?
Right now it seems to be simply setInterval ( <function-text:string>,
<interval:numbe r> )


It works fine with a function.

Just try
setInterval(fun ction(){alert(" foo");},2000);
(and be ready to close the window in one of the breaks).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'


This is a 'simplified' version of what I thought wasn't working, but dangit,
it works.

function foo (N1) {
function bar (N2) {
this.liftOffIn (N2)
}
bar.prototype.l iftOffIn = function (N3) {
this.N = N3
var thisobj = this
this.timerId = setInterval ( function () { thisobj.count() }, 1250 )
}
bar.prototype.c ount = function () {
if (this.N<1) {
alert ('Done')
clearInterval (this.timerId)
return
}
alert (this.N)
this.N--
}
new bar (N1)
}

foo (5)
--
Richard A. DeVenezia
Jul 20 '05 #5
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> wrote in message
news:bj******** ****@ID-168040.news.uni-berlin.de...
"Lasse Reichstein Nielsen" <lr*@hotpop.com > wrote in message
news:65******** **@hotpop.com.. .
"Richard A. DeVenezia" <ra******@ix.ne tcom.com> writes:
It works fine with a function.


Yup, it sure does! The problem was this

in Mozilla
element.style.b ackgroundColor = '#FFFF00';
alert (element.style. backgroundColor ); // shows rgb (255,255,0)

Seeing how my function scheduled to run expected #rrggbb when reading the
color back, it was destined to break when it came across the rgb()
translation Mozilla so nicely did.

--
Richard A. DeVenezia
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2887
by: Joseph Misko | last post by:
I am on WinXP. The following page works perfectly in IE6. For Netscape 7.0, I have to move off of the image and then back on to get the fade to take effect, and with Mozilla (latest version) a series of close mouseovers will cause the screen to go wacko. Does anyone have input on how to get Netscape/Mozilla to work with a fade like this? Thanks!
5
1721
by: Ivan Marsh | last post by:
Hey Folks, This code works in IE but not in Mozilla. I'd like it to work in both. I'm sure it has something to do with the way I'm passing the anchor object but I can't figure it out. <SCRIPT TYPE='text/JavaScript'> function GetTime(TimeAnchor) { today = new Date();
17
2111
by: George Hester | last post by:
Hoe can I use setInterval where its argument is a function which also has an argument? For example I have a function change(Msg) where Msg is dynamically generated and returns nothing at this point (other than true I guess). I would like to have setInterval(change(Msg)); but that doesn't work. Any suggestions? Thanks. -- George Hester __________________________________
3
4393
by: Eli | last post by:
Hello all, I have just added a small piece of JavaScript code to a basic HTML page of mine. At the end of the page (after the closing </HTML>) I added: <SCRIPT LANGUAGE="JavaScript"> window.setInterval ("myFunc()", 1000); </SCRIPT> The function myFunc is as easy as you might expect, to update a text
1
2036
by: John Smith | last post by:
Can you tell me why Mozilla can't show some Javascript? example: function high(which2){ theobject=which2 highlighting=setInterval("highlightit(theobject)",50) } function low(which2){ clearInterval(highlighting) if (which2.style.MozOpacity)
1
1161
by: Caledonia_558 | last post by:
Hi everyone, I'm having trouble with a bit of code to make a paragraph of text change colour every second to a new, random colour: Here's the script's function: <script type="text/javascript"> function change() { re="rgb("+Math.round(Math.random()*256)+","+ Math.round(Math.random()*256)+","+Math.round(Math.random()*256)+")"
6
15207
by: marktm | last post by:
Hi- I am trying to use setInterval to call a method within an object and have not had any luck. I get "Object doesn't support this property or method" when I execute the following code. What I am doing wrong? Your help will be much appreciated. Thanks
1
2303
by: rajesh | last post by:
var fixedX = -1 // x position (-1 if to appear below control) var fixedY = -1 // y position (-1 if to appear below control) var startAt = 0 // 0 - sunday ; 1 - monday var showWeekNumber = 0 // 0 - don't show; 1 - show var showToday = 1 // 0 - don't show; 1 - show var imgDir = "images/" // directory for images ... e.g. var imgDir="/img/" var gotoString = "Go To Current Month" var todayString = "Today is"
3
5796
by: shawn | last post by:
Hi All Was trying to get this bit of code working (simplified of course) for (i=0;i<uuid_num;i++) { window.setInterval(InitMap(uuidValues), timePeriod); } Where uuid_num, uuidValues, timePeriod are defined above, along with function InitMap.
1
8535
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.