数秒待ってからフェードアウトして消える 複数指定が可能で、個々にタイミングをずらせます。 しかも・・

初期化と、フェードアウトする前と終わった後に、指定した関数を実行できる

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title></title>
<style type="text/css">
</style>
<h1 id="a">なんだか薄くなる</h1>
<h1 id="b">なんだか薄くなる</h1>

<script type="text/javascript">
//@cc_on

function FadeOutMessenger () {
  this.initializer.apply( this, arguments );
}

FadeOutMessenger.prototype.initializer = function ( id, wait, step, span, iFunc, sFunc, eFunc ) {
  var e = document.getElementById( id );
  if(! e ) return null;
  this.obj = { 'element': e, 'wait': wait, 'step': step || -5, 'span': span || 50, 'sFunc': sFunc, 'eFunc': eFunc };
  this.timeoutId  = null;
  this.intervalId = null;
  if( 'function' == typeof iFunc ) iFunc.call( this, e );
};

FadeOutMessenger.prototype.set = function ( text ) {
  var t, o = this.obj, e = o.element;
  if( this.timeoutId  ) clearTimeout( this.timeoutId );
  if( this.intervalId ) clearInterval( this.intervalId );
  if( 'function' == typeof o.sFunc ) o.sFunc.call( this, e );
  if( text ) {
    t = document.createTextNode( text );
    while( e.hasChildNodes() ) e.removeChild( e.firstChild );
    e.appendChild( t );
  }
  
  this.setOpacity( this.opacity = 100 );

  return this.timeoutId = setTimeout( (function(_cb) {
    return function() {
      _cb.intervalId = setInterval( (function(__cb) { return function(){ __cb.decrease(); }; })(_cb), _cb.obj.span );
      _cb.decrease();
    };
  })(this), this.obj.wait );
};

FadeOutMessenger.prototype.setOpacity = function ( alpha ) {
  var s = this.obj.element.style;
  s./*@if( @_jscript ) filter = 'alpha( opacity =' + alpha + ')'
    @else@*/ opacity = alpha /100 + '' /*@end@*/;
};

FadeOutMessenger.prototype.decrease = function ( ) {
  this.opacity += this.obj.step;
  if( this.opacity < 0 ) {
    this.opacity = 0;
    clearInterval( this.intervalId );
    if( 'function' == typeof this.obj.eFunc ) this.obj.eFunc.call( this, this.obj.element );
  }
  this.setOpacity( this.opacity );
};

function func0() { alert("はじめるよ"); };
function func1() { alert("h1のもじがabcdefにかわるよ"); };
function func2() { alert("消えたよ!次も消すよ"); fadeout2.set() };

var fadeout = new FadeOutMessenger( 'a', 1000, -5, 50, func0, func1, func2);
fadeout.set('abcdefg');
var fadeout2 = new FadeOutMessenger( 'b', 1000, -1, 10);
// fadeout2.set(); //bが消える
</script>

役に立つのか?!
たぶん、エラーを表示させて、じょじょに消すとか・・・