//Normal OutputWindow.onload=function(){ varDiv=document.getelementbyid (' div '); varTimer=NULL; Div.style.display= ' None '; Div.style.opacity= ' 0 '; functionFadein (Elem, speed, opacity) {Elem.style.display= ' Block '; Elem.style.opacity= val/100; varval = 0; (function() {elem.style.opacity= val/100; Val+ = 10; Console.log (Val); if(Val <= opacity+500) {setTimeout (Arguments.callee, speed); } })(); } document.getElementById (' btn '). onclick=function() {Fadein (div,1000,100); }}//not normal, unable to read ElemWindow.onload=function(){ varDiv=document.getelementbyid (' div '); varTimer=NULL; Div.style.display= ' None '; Div.style.opacity= ' 0 '; functionFadein (Elem, speed, opacity) {Elem.style.display= ' Block '; Elem.style.opacity= val/100; varval = 0; Elem.style.opacity= val/100; Val+ = 10; Console.log (Val); if(Val <= opacity+500) {setTimeout (Arguments.callee, speed); }} document.getElementById (' btn '). onclick=function() {Fadein (div,1000,100); }}//not normal, has been output tenWindow.onload=function(){ varDiv=document.getelementbyid (' div '); varTimer=NULL; Div.style.display= ' None '; Div.style.opacity= ' 0 '; functionFadein (Elem, speed, opacity) {Elem.style.display= ' Block '; Elem.style.opacity= val/100; varval = 0; Elem.style.opacity= val/100; Val+ = 10; Console.log (Val); if(Val <= opacity+500) {setTimeout (function() {Fadein (Elem, speed, opacity); },speed); }} document.getElementById (' btn '). onclick=function() {Fadein (div,1000,100); }}//Normal OutputWindow.onload=function(){ varDiv=document.getelementbyid (' div '); varTimer=NULL; Div.style.display= ' None '; Div.style.opacity= ' 0 '; varval = 0; functionFadein (Elem, speed, opacity) {Elem.style.display= ' Block '; Elem.style.opacity= val/100; Console.log (Val); if(Val <= opacity+500) {Val+ = 10; Elem.style.opacity= val/100; SetTimeout (function() {Fadein (Elem, speed, opacity); },speed); }} document.getElementById (' btn '). onclick=function() {Fadein (div,1000,100); }}
JavaScript fade in and out