Syndicate content

Javascript: setTimeout()

The other day, I wrote a module for Drupal. Up to here, no problem. What I wrote required a small amount of Javascript to make a dropdown menu feature work. That worked just fine under Mozilla and FireFox, and even Safari & Konqueror.

When I tried with Internet Explorer, nope. Not working at all.

The function I was using goes like this:

	setTimeout(<function name>, <# of milliseconds>[, <function parameters>]);

This is neat since you can call the named function and you in effect pass the <function parameters> to the function. This is very handy and looks like an object oriented programming scheme.

Internet Explorer does not support the last parameter. This means you need to use a global. So if you have to handle a time out for 10 different objects, you better have 10 different functions to handle each one of them. Luckily, you can do that in Javascript by creating a function in a variable. (Look at the AddThis.com code to see an example of that. They use it at length, so to speak!)

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.