/    Sign up×
Community /Pin to ProfileBookmark

hide input borders – show onHover/focus?

Sooooo close!!!

omousover, onmouseout, and onfocus all work but not onblur and I can’t figure out why. Anyone???

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title></title>
<style type=”text/css”>
input {
margin:1px;
border:0;
background:#CCC;
color:#000;
}
input:hover, .inputover {
margin:0;
border:1px solid #000;
}
</style>
<script type=”text/javascript”>
function setClass()
{
var theInputs = document.getElementsByTagName(‘input’);
for (var i = 0, thisInput; thisInput = theInputs[i]; i++)
{
if (thisInput.type == ‘text’)
{
thisInput.onmouseover = function()
{
this.className += (this.className) ? ‘ inputover’ : ‘inputover’
}
thisInput.onmouseout = function()
{
this.className = (this.className == ‘inputover’) ? ” : this.className.replace(‘ inputover’, ”)
}
{
thisInput.onfocus = function()
{
this.className += (this.className) ? ‘ inputfocus’ : ‘inputfocus’
}
thisInput.onblur = function()
{
this.className = (this.className == ‘inputfocus’) ? ” : this.className.replace(‘ inputfocus’, ”)
}
}
}
}
}
onload = setClass;
</script>
</head>

<body>
<input type=”text”>
<input type=”text”>
<input type=”text”>
<input type=”submit”>
</body>
</html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @tjmcd spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...