Source (JavaScript)

n = 0;
colors = ["pink","yellow","cyan","yellowgreen","violet"];

function kirakiraBdr(elem) {
	elem.style.borderColor = colors[n];
	if (n < colors.length - 1) n++;
	else n = 0;
	elem2 = elem;
	timerID = setTimeout('kirakiraBdr(elem2)',90);
}
function stopKKB(elem) {
	clearTimeout(timerID);
	elem.style.borderColor = "black";	
}

Source (HTML)

<html>

<head></head>

<body>
<form>
<input type="text" size="40" style="border:1px solid black;" onfocus="kirakiraBdr(this)" onblur="stopKKB(this)" />
<textarea rows="5" cols="20" style="border:1px solid black;" onfocus="kirakiraBdr(this)" onblur="stopKKB(this)">
</textarea>
</form>
</body>

</html>

Hints: