Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 371231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:05:41+00:00 2026-05-12T14:05:41+00:00

I’m pretty new to Javascript and have been trying to achieve some fading effects

  • 0

I’m pretty new to Javascript and have been trying to achieve some fading effects on a website.
I’ve managed to hammer together the effects I want and everything’s working fine on Firefox & Safari. However IE doesn’t like it. The first script to change the background colour works but the second script to fade in the content does nothing.

I’m calling the scripts from the head as follows:

window.onload=siteIntro;

And the Javacript which is not working is here. Any help or suggestions would be appreciated, the live site can be viewed if needed.

Many Thanks

// ################# Fade Divs ###############################

function Fade(objID,CurrentAlpha,TargetAlpha,steps){

    var obj = document.getElementById(objID);

    CurrentAlpha = parseInt(CurrentAlpha);
    if (isNaN(CurrentAlpha)){
        CurrentAlpha = parseInt(obj.style.opacity*100);
        if (isNaN(CurrentAlpha))CurrentAlpha=100;
    }
    var DeltaAlpha=parseInt((CurrentAlpha-TargetAlpha)/steps);
    var NewAlpha = CurrentAlpha - DeltaAlpha;

    if (NewAlpha == 100 && (navigator.userAgent.indexOf('Gecko') != -1 && navigator.userAgent.indexOf('Safari') == -1)) NewAlpha = 99.99;

    obj.style.opacity = (NewAlpha / 100);
    obj.style.MozOpacity = obj.style.opacity;
    obj.style.KhtmlOpacity = obj.style.opacity;
    obj.style.filter = 'alpha(opacity='+NewAlpha+')';

    if (steps>1){
        setTimeout('Fade("'+objID+'",'+NewAlpha+','+TargetAlpha+','+(steps-1)+')', 50);
    }
}

// ################# Toggle content div visibility ###############################
function mainVis(showMain) {
    document.getElementById(showMain).style.visibility ="visible";
}

function pageSwitch(show0, hide0, hide1, hide2, hide3) {
    document.getElementById(show0).style.visibility ="visible";
    document.getElementById(hide0).style.visibility ="hidden";
    document.getElementById(hide1).style.visibility ="hidden";
    document.getElementById(hide2).style.visibility ="hidden";
    document.getElementById(hide3).style.visibility ="hidden";
}

function pg1() {
    pageSwitch('prices', 'icon', 'about', 'map', 'news');
    Fade('prices','0',100,30)
}
function pg2() {
    pageSwitch('about', 'icon', 'prices', 'map', 'news');
    Fade('about','0',100,30)
}
function pg3() {
    pageSwitch('map', 'icon', 'about', 'prices', 'news');
    Fade('map','0',100,30)
}
function pg4() {
    pageSwitch('news', 'icon', 'map', 'about', 'prices');
    Fade('news','0',100,30)
}

// ################# Site Intro Functions ###############################

function siteIntro() {
    setTimeout("NLBfadeBg('b1','#FFFFFF','#000000','3000')",2000);
    mainVis('main');
    setTimeout("Fade('main','',100,30)",5000);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:05:41+00:00Added an answer on May 12, 2026 at 2:05 pm

    MS filters only apply to elements that “have layout”.

    To force layout, you can give the element a width or a height, or use the old zoom: 1; trick.

    Not sure if this is the cause of your problems, but you could try it.

    You can read more about hasLayout here.

    Another thing, instead of:

    setTimeout('Fade("'+objID+'",'+NewAlpha+','+TargetAlpha+','+(steps-1)+')', 50)` 
    

    you can simply write:

    setTimeout(function() { Fade(objID, NewAlpha, TargetAlpha, steps-1); }, 50)`
    

    Unless you are doing it just for fun and/or learning, just use an existing JS library instead of re-inventing the wheel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.