By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

blinking textbox in javascript, html and asp

P: 67
Hi!

I want to blink the textbox and place the cursor in that text box. (If the user didn't enter the name and click the submit button. That time, the text box want to blink "two or three times") How? I didn't have any idea.... so please help me..
Expand|Select|Wrap|Line Numbers
  1. <form action="demo_disquery.asp" method="get">
  2. Your name: <input type="text" name="name" size="25" />
  3. Age: <input type="text" name="age" size="3" />
  4. <input type="submit" value="Submit" />
  5. </form>
  6.  
Thanks and Regards,
Susan.
Apr 22 '09 #1
Share this Question
Share on Google+
5 Replies


dmjpro
100+
P: 2,476
What do you mean by "blink the text box two or three times"?
Apr 22 '09 #2

P: 67
If the user didn't enter the name in the textbox, but the enter the age and click the submit button. that time "the name textbox want to blink".(I know how to display alert message, but i don't know how to blinking the textbox.)

Thanks and Regards,
Susan.
Apr 22 '09 #3

gits
Expert Mod 5K+
P: 5,390
have a look at the following example, just click the textbox to let it 'blink' :)

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function blinkBox() {
  5.     var n = document.getElementById('myTbox');
  6.     var t = 6;
  7.     var b = 0;
  8.     var c = [ 'red', 'white' ];
  9.  
  10.     var i = window.setInterval(function() {
  11.         n.style.backgroundColor = 
  12.             n.style.backgroundColor != c[0] ? c[0] : c[1];
  13.  
  14.         b++;
  15.  
  16.         if (b == t) {
  17.             window.clearInterval(i);
  18.         }
  19.     }, 500);
  20. }
  21. </script>
  22. </head>
  23. <body>
  24.     <input type="text" id="myTbox" onclick="blinkBox();"/>
  25. </body>
  26. </html>
  27.  
kind regards
Apr 22 '09 #4

dmjpro
100+
P: 2,476
Here you alternate the "backgroundColor", i may blink the "borderColor" ;)
Apr 22 '09 #5

gits
Expert Mod 5K+
P: 5,390
of course you may 'blink' whatever style you want ... it's just a simple example for how to do such things ...

kind regards
Apr 22 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.