ho trovato questo codice, ho dovuto modificarlo perchè io devo far scomparire un div e far comparire nello stesso istante un altro, sempre in dissolvenza, però non funziona e non capisco perchè
codice:
<style type="text/css">
/* Style for Fade-In Page script */
#fadeDiv {
display:none;
}
/* End Style for Fade-In Page script */
</style>
<script type="text/javascript">
var ID = "fadeDiv";
fadeInPage.speed=50; //Set speed of transition for non-IE, lower numbers are faster, 20 is the minimum safe value
fadeInPage.bg='#c0c0c0'; //Set backgroud style (color or color and image) of transition division for non-IE, should match page background or the predominant color of the page
if(document.getElementById(ID) && document.getElementById(ID).style){
fadeInPage.d=document.getElementById(ID), fadeInPage.t=function(o){return typeof fadeInPage.d.style[o]=='string'};
fadeInPage.prprt=fadeInPage.t('opacity')? 'opacity' : fadeInPage.t('MozOpacity')? 'MozOpacity' : fadeInPage.t('KhtmlOpacity')? 'KhtmlOpacity' : null;
}
fadeInPage.set=function(){
var prop=fadeInPage.prprt=='opacity'? 'opacity' : fadeInPage(ID).prprt=='MozOpacity'? '-moz-opacity' : '-khtml-opacity';
document.write('\n<style type="text/css">\n#'+next_div+' {\nheight:'+window.innerHeight+'px;display:block;position:fixed;'+
'z-index:10000;top:0;left:0;background:'+fadeInPage.bg+';width:100%;\n'+ prop +':1;\n}\n<\/style>\n');
}
if(window.addEventListener&&fadeInPage.prprt){
fadeInPage.set();
window.addEventListener('load', fadeInPage, false);
}
function fadeInPage(ID){
//alert(ID);
var el=document.getElementById(ID);
//alert(el);
el.style[fadeInPage.prprt] = el.style[fadeInPage.prprt] == ''? 1 : el.style[fadeInPage.prprt];
if (el.style[fadeInPage.prprt] > 0){
el.style[fadeInPage.prprt] = el.style[fadeInPage.prprt] - 0.02;
setTimeout("fadeInPage("+ID+")", fadeInPage.speed);
}
else {
el.style[fadeInPage.prprt] = 0;
if(document.removeChild)
el.parentNode.removeChild(el);
}
//alert(next_div);
}
</script>
</head>
<body>
<div id="fadeDiv" onClick="fade('uno')">fade div</div>
questo dovrebbe far apparire il primo div (fadeDiv) ma non lo fa e non capisco perchè