The way you are using this code, you should *NOT* be using setInterval.
Use setTimeout( ) instead.
Also, you need to pass the argument to setTimeout as a string.
You also will *NOT* need or want the clearInterval() call, at all.
Oh, w.t.h.
Here, let's simplify for you:
Code:
function viewData()
{
loopOpacity(100);
}
function loopOpacity(percent)
{
document.getElementById("fade").style.opacity = (percent/100);
if( percent > 40 )
{
setTimeout("loopOpacity(" + (percent-10) + ")", 300);
} else {
document.getElementById("viewData").className = "view";
}
}