Highlight Form Element

Posted: November 4, 2007 in JavaScript Stuffs
Tags: , ,


Heading


Highlight From Element

Description


JavaScript “Highlight focused form element” ;[ Highlight Element ]

Preview

highlight.jpg

Code

<html>

<head>

<script language=”javascript”
type=”text/javascript”>

var fifteenth=”#07D5EB”;

var sixteenth=document.getElementById&&!document.all;

var seventeenth=”;

var eighteenth;

var nineteenth=/INPUT|TEXTAREA|SELECT|OPTION/;

function twentieth(first2)

{

if
(first2.style&&nineteenth.test(first2.tagName))

{

if (sixteenth&&eighteenth.nodeType==3)eighteenth=eighteenth.parentNode.parentNode;

return true;

}

else return false;

}

function second2(third2)

{

eighteenth=sixteenth?
third2.target : event.srcElement;

if (seventeenth!=”)

{

if (twentieth(seventeenth))seventeenth.style.backgroundColor=”;

seventeenth=eighteenth;

if (twentieth(eighteenth))eighteenth.style.backgroundColor=fifteenth;

}

else

{

if (twentieth(eighteenth))eighteenth.style.backgroundColor=fifteenth;

seventeenth=eighteenth;

}

}

</script>

<title></title>

</head>

<body>

<form onKeyUp=”second2(event)”
onClick=”second2(event)”>

<input name=”textfield”
type=”text” value=”Click Here!”><br>

<input name=”textfield2″
type=”text” value=”Click Here!”><br>

<textarea name=”textarea”>Click
Here!</textarea>

</form>

</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