Posted by: prajapatinilesh | September 14, 2007

JavaScript + Blinking TextBox

Hi today I trying to make a blinking text box and found an important script from the web. I have created a html page and test it. Its really very good script. So if do you want to craete a blinking textbox, go through the following code and you can create your own blinking textbox.

<HTML>
<HEAD>
<TITLE> Blinking TextBox </TITLE>
<script>
window.Blink = function(args)
{
args = (/,/.test(args))? args.split(/,/): [args,’#FFD100′,10];
var who = document.getElementById(args[0]);
var count = parseInt(args[2]);
if (–count <=0)
{
who.style.backgroundColor = ”;
if(who.focus) who.focus();
}
else
{
args[2]=count+”;
who.style.backgroundColor=(count%2==0)? ”: args[1];
args=’\”‘+args.join(’,’)+’\”‘;
setTimeout(”Blink(”+args+”)”,500);
}
}
</script>
</HEAD>

<BODY onLoad=”Blink(’name’);”>
<table>
<tr>
<td width=”50″><b>Name:</b></td>
<td width=”300″>
<input id=”name” type=”text”>
</td>
</tr><tr>
<td width=”50″><b>E-mail:</b></td>
<td width=”300″>
<input id=”email” type=”text”>
</td>
</tr>
<tr>
<td colspan=”2″ align=”center”>
<input type=”button” value=”Submit” onClick=”alert(’Your form would have been submitted’)”>
</td>
</tr>
</table>
</BODY>
</HTML>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: