473,387 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

setTimeout not working on IE

I am trying to fade a word out, so after 5 seconds then every 1/4 sec
it should fade by a small amount, until it is gone.

This works fine in Firefox, but IE never calls the function that
setTimeout points to.

I am using IE 6, btw, on WinXP SP2.

browserdetect=savedspan.filters? "ie" : typeof
savedspan.style.MozOpacity=="string"? "mozilla" : "";
if (browserdetect=="mozilla") {
savedspan.style.MozOpacity = 1.0;
setTimeout(fadeSaved, 5000);
} else if (browserdetect=="ie") {
//alert("gradeSavedResult: inside the IE part");
savedspan.filters.alpha.opacity = 1.0; // This should only be used
in ie
window.setTimeout("fadeSaved()", 5000);
}
function fadeSaved() {
alert("fadeSaved: ");
}

I tried it with 'setTimeout(fadeSaved, 5000)' also, but that didn't
work.

Any idea why setTimeout wouldn't be working on IE?

Thanx.

Apr 14 '06 #1
1 7074
James Black said the following on 4/14/2006 1:27 PM:
I am trying to fade a word out, so after 5 seconds then every 1/4 sec
it should fade by a small amount, until it is gone.

This works fine in Firefox, but IE never calls the function that
setTimeout points to.

I am using IE 6, btw, on WinXP SP2.
You shouldn't indent your code that much, it makes it a pain to do
anything with when it gets wrapped.
browserdetect=savedspan.filters? "ie" : typeof
savedspan.style.MozOpacity=="string"? "mozilla" : "";
Problem #1: Browser Detection
<URL: http://jibbering.com/faq/#FAQ4_26 >

If you want to use MozOpacity then test for it. If you want to use
filters then test for them - not for something in a useless UA string.
if (browserdetect=="mozilla") {
savedspan.style.MozOpacity = 1.0;
setTimeout(fadeSaved, 5000);
} else if (browserdetect=="ie") {
//alert("gradeSavedResult: inside the IE part");
savedspan.filters.alpha.opacity = 1.0; // This should only be used
in ie
window.setTimeout("fadeSaved()", 5000);
}
function fadeSaved() {
alert("fadeSaved: ");
}

I tried it with 'setTimeout(fadeSaved, 5000)' also, but that didn't
work.


There may be something else in your code, that isn't posted, that is
interfering with it. Post a small sample page that demonstrates
setTimeout not working properly.

var myTimer = window.setTimeout(myFunction,2000)
function myFunction(){
alert('Inside myFunction')
}

But, you might prefer setInterval over setTimeout and then have a
counter that will clear the interval after enough time to finish the fade.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 14 '06 #2

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
by: oliver | last post by:
Hi, the structure of my source code is like this: <script> C = function(){ //some initialization } C.prototype.start = function{ //some action
2
by: Athanasius | last post by:
Could someone shed some light as to why the following setTimeout function will not work on the Mac IE5.2? It does however work on PC(Forefox,Netscape,IE) & Mac(Safari,Firefox). Here is the script,...
3
by: jshanman | last post by:
I've created a "Play" button for my timeline that uses the Google Maps API. It basicly scrolls the timeline x interval every y milliseconds. The problem is the browser responds slowly even after...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
28
by: Andre | last post by:
Hi, Does anyone know whether the ECMA, or an other standard document, specifies a maximum for the value that can be pass to the setTimeOut() function in Javascript? Andre
17
by: blueapricot416 | last post by:
This is a very basic question -- but I can't find the answer after looking for 20 minutes. If you code something like: function set_It() { setTimeout('Request_Complete("apple", -72)',5000) }...
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
7
by: Martin | last post by:
Can I have two setTimeouts running at the same time - with two different intervals? I want to start one timer and, before it times out, start another one I've tried this and they seems to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.