Sunday, May 30, 2010

show hide prompt msg.



protected virtual void ShowMsg(Label labelName, string strMsg)
{
labelName.Text = strMsg;
StringBuilder sb = new StringBuilder();
sb.Append("");
ClientScript.RegisterStartupScript(GetType(), "ss", sb.ToString());
}

//javascript

function fadeIn(id, steps, duration, interval, fadeOutSteps, fadeOutDuration) {
for (i = 0; i <= 1; i += (1 / steps)) {
setTimeout("setOpacity('" + id + "', " + i + ")", i * duration);
fadeInComplete = i * duration;
}
//set the timeout to start after the fade in time and the interval to display the
//message on the screen have both completed
setTimeout("fadeOut('" + id + "', " + fadeOutSteps + ", " + fadeOutDuration + ")", fadeInComplete + interval);

}

function fadeOut(id, steps, duration) {
var fadeOutComplete;
for (i = 0; i <= 1; i += (1 / steps)) {
setTimeout("setOpacity('" + id + "', " + (1 - i) + ")", i * duration);
fadeOutComplete = i * duration;
}
//completely hide the displayed message after the fade effect is complete
setTimeout("hide('" + id + "')", fadeOutComplete);
}

function hide(id) {
document.getElementById(id).style.display = 'none';
}

No comments:

Post a Comment