Javascript - How to animate text in a field


SUBMITTED BY: amankalsi22

DATE: Oct. 3, 2016, 5:44 p.m.

FORMAT: Text only

SIZE: 1.5 kB

HITS: 964

  1. <HTML>
  2. <HEAD>
  3. <TITLE> Animated Text</TITLE>
  4. </HEAD>
  5. <BODY >
  6. <FORM NAME="f1">
  7. <TABLE>
  8. <TR> <TD> <INPUT NAME="ta1" TYPE="text" SIZE="20">
  9. <TD> <INPUT NAME="ta2" TYPE="text" SIZE="20">
  10. <TD> <INPUT NAME="ta3" TYPE="text" SIZE="20">
  11. </TABLE></FORM>
  12. <HR>
  13. <FORM NAME="f2" ACTION="http://myformaction.com/" METHOD="POST">
  14. <CENTER>
  15. Name <INPUT NAME="pername" TYPE="text" SIZE="20"> Name<P>
  16. Age <INPUT NAME="perage" TYPE="text" SIZE="5"> Age<P>
  17. Occupation <INPUT NAME="perocc" TYPE="text" SIZE="20">Occupation <P>
  18. <INPUT TYPE="Submit" VALUE="Submit">
  19. <INPUT TYPE="Reset" VALUE="Reset">
  20. </CENTER>
  21. </FORM>
  22. <HR>
  23. <FORM NAME="f3">
  24. <TABLE>
  25. <TR> <TD> <INPUT NAME="ta4" TYPE="text" SIZE="20">
  26. <TD> <INPUT NAME="ta5" TYPE="text" SIZE="20">
  27. <TD> <INPUT NAME="ta6" TYPE="text" SIZE="20">
  28. </TABLE></FORM>
  29. <SCRIPT LANGUAGE= "javascript">
  30. setTimeout("document.f1.ta1.value = 'Answer Soon'", 1000)
  31. setTimeout("document.f1.ta1.value = ''", 1300)
  32. setTimeout("document.f1.ta2.value = 'Answer Soon'", 1600)
  33. setTimeout("document.f1.ta2.value = ''", 1900)
  34. setTimeout("document.f1.ta3.value = 'Answer Soon'", 2200)
  35. setTimeout("document.f1.ta3.value = ''", 2500)
  36. setTimeout("document.f3.ta4.value = 'Answer Soon'", 2800)
  37. setTimeout("document.f3.ta4.value = ''", 3100)
  38. setTimeout("document.f3.ta5.value = 'Answer Soon'", 3400)
  39. setTimeout("document.f3.ta5.value = ''", 3700)
  40. setTimeout("document.f3.ta6.value = 'Answer Soon'", 4000)
  41. setTimeout("document.f3.ta6.value = ''", 4300)
  42. </SCRIPT>

comments powered by Disqus