【发布时间】:2013-01-25 10:00:45
【问题描述】:
我正在制作website。当您单击我的搜索框时,文本会消失,就像它应该的那样,但是一旦您单击离开,文本就不会回来,我希望它会。这是我的sn-p
<div class='search'>
<form method="get" id='search' action="http://www.google.com/search">
<input type="hidden" name="q" size="31" maxlength="255" value="Site Name:" />
<input type="text" name="q" size="31" maxlength="255" style="height: 24px;" value="Search..." onFocus="this.value=''" />
</div>
我在它后面有很多 css 来使文本框放大和改变颜色。这是代码,以防万一。
#search input[type="text"] {
background: url(imgs/search-white.png) no-repeat 10px 6px #444;
border: 0 none;
font: bold 12px Arial,Helvetica,Sans-serif;
color: #d7d7d7;
width:150px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
outline: none;
}
#search input[type="text"]:focus {
background: url(imgs/search-dark.png) no-repeat 10px 6px #fcfcfc;
color: #6a6f75;
width: 175px;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
outline: none;
}
div.search
{
position:fixed;
top:8px;
right:5px;
}
单击框时,框会放大,Search... 文本会按预期消失。但是,一旦您单击离开,文本就不会返回,我希望它能够返回。我怎么做?
*边注
抱歉,如果网站看起来很糟糕,我 13
【问题讨论】:
-
顺便说一下,Java 和 Javascript 是两种非常不同的语言。你想要 Javascript,一种网络语言。 Java 用于制作真正的 程序——通过双击桌面上的图标运行的那种程序。 (无意冒犯网络程序员)
-
@MathSquared11235 谢谢你我不知道
-
@MathSquared11235 stackoverflow.com/questions/14793773/…
标签: java html css textbox maskedtextbox