Click here to Skip to main content
11,720,562 members (68,136 online)
Click here to Skip to main content

Tagged as

Blinking Text in TextBox using Javascript

, 24 Nov 2011 CPOL 15.3K 3
Rate this:
Please Sign up or sign in to vote.
Blinking Text in TextBox using Javascript


After seeing this question[^] in Q/A section, I just created this thing in Javascript & now posting here.


<title>Blinking Text in TextBox using Javascript</title>
<script language="javascript" type="text/javascript">
var timer;
function BlinkingText()
 if(document.getElementById("txtName").value == "")
   document.getElementById("txtName").value = "Enter your name..";
   document.getElementById("txtName").value = "";
 timer = setTimeout("BlinkingText()", 500);
function StopBlinking()
function ContinueBlinking()
  if(document.getElementById("txtName").value == "Enter your name.." || document.getElementById("txtName").value == "")
function DoFocus()
  if(document.getElementById("txtName").value == "Enter your name.." || document.getElementById("txtName").value == "")
    document.getElementById("txtName").value = "";
<body onload="BlinkingText()">
Name : <input type="text" id="txtName" value="Enter your name.." onfocus="DoFocus();" onblur="ContinueBlinking();" />

Browser Compatibility

I have tested this script in the following Web browsers:
  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Opera


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
Programmer | Dude | ||||||

About him & his blog? check out here. Currently he's updating the site, he'll return soon there with more things*.

In Codeproject, he posted a blogpost & more than couple of Tip/Tricks, hope he'll write more soon.

Favorite techs are MVC, WCF, Mobile, HTML5, CSS3, jQuery, etc.,

His hobbies are watching movies, CP, being alone, etc., But now he's working on something*.

* - SCAMP???

You may also be interested in...

Comments and Discussions

QuestionMy 5 Pin
King Fisher1-Apr-15 8:01
professionalKing Fisher1-Apr-15 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150901.1 | Last Updated 24 Nov 2011
Article Copyright 2011 by thatraja
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid