blinking textbox in javascript, html and asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shivasusan
    New Member
    • Oct 2008
    • 67

    blinking textbox in javascript, html and asp

    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..
    Code:
    <form action="demo_disquery.asp" method="get">
    Your name: <input type="text" name="name" size="25" />
    Age: <input type="text" name="age" size="3" />
    <input type="submit" value="Submit" />
    </form>
    Thanks and Regards,
    Susan.
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    What do you mean by "blink the text box two or three times"?

    Comment

    • shivasusan
      New Member
      • Oct 2008
      • 67

      #3
      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.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        have a look at the following example, just click the textbox to let it 'blink' :)

        Code:
        <html>
        <head>
        <script type="text/javascript">
        function blinkBox() {
            var n = document.getElementById('myTbox');
            var t = 6;
            var b = 0;
            var c = [ 'red', 'white' ];
            
            var i = window.setInterval(function() {
                n.style.backgroundColor = 
                    n.style.backgroundColor != c[0] ? c[0] : c[1];
                
                b++;
                
                if (b == t) {
                    window.clearInterval(i);
                }
            }, 500);
        }
        </script>
        </head>
        <body>
            <input type="text" id="myTbox" onclick="blinkBox();"/>
        </body>
        </html>
        kind regards

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #5
          Here you alternate the "backgroundColo r", i may blink the "borderColo r" ;)

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            of course you may 'blink' whatever style you want ... it's just a simple example for how to do such things ...

            kind regards

            Comment

            Working...