i have this PHP based doc (chatbox) where you can type your message and send it.
Now, i have this fade animation where a message es in when a message is send. Looks like this:
Javascript:
function stateChanged1()
{
if (xmlHttp1.readyState==4)
{
document.getElementById("sent").innerHTML="Sent!";
document.writeform.message.value="";
chat();
}
}
in the body:
<span id="sent"></span>
The problem is then it isnt fading out. What do i have to add to the code and where?
i have this PHP based doc (chatbox) where you can type your message and send it.
Now, i have this fade animation where a message es in when a message is send. Looks like this:
Javascript:
function stateChanged1()
{
if (xmlHttp1.readyState==4)
{
document.getElementById("sent").innerHTML="Sent!";
document.writeform.message.value="";
chat();
}
}
in the body:
<span id="sent"></span>
The problem is then it isnt fading out. What do i have to add to the code and where?
Share Improve this question asked Oct 19, 2009 at 11:44 Deniz ZoetemanDeniz Zoeteman 10.1k26 gold badges72 silver badges98 bronze badges 1- Where is your 'fading out' code? There is nothing to do with fading in the posted snippet. – bobince Commented Oct 19, 2009 at 12:33
4 Answers
Reset to default 5For Effects like fading out use a framework like JQuery, Prototype or MooTools. They will provide you with ample examples how to apply effects to elements.
Add
<script type="text/javascript" src="http://ajax.googleapis./ajax/libs/jquery/1.3.2/jquery.min.js"></script>
to your HTML and add this JavaScript Code:
$("#sent").fadeOut("slow");
after this line:
document.getElementById("sent").innerHTML="Sent!";
try jquery you can fadein and fade out an element easly e.i:
$("#sent").fadeIn("slow");
$("#sent").fadeOut("slow");
i also remend that you should use jquery's fade in and fade out function. for a deeper explanation and code samples please goto: http://docs.jquery./Effects/fadeOut