我在做一個website。當你點擊我的搜索框時,文本會消失,就像它應該的那樣,但是一旦你點擊文本就不會回來,我希望它能夠。這裏是我的代碼段Css/Html文本框消失文本不起作用
<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...
文本消失喜歡它應該。但是,一旦你點擊文本不會返回,我希望它。我怎麼做? *側面說明 對不起,如果網站看起來壞的IM 13
順便說一下,Java和Javascript是兩種*非常*不同的語言。你想要Javascript,網頁語言。 Java被用來製作* real *程序 - 這種類型是通過雙擊桌面上的圖標來運行的。 (網絡程序員沒有冒犯) – MathSquared 2013-02-10 01:36:17
@ MathSquared11235謝謝你,我並不知道 – 2013-02-10 01:40:57
@ MathSquared11235 http://stackoverflow.com/questions/14793773/auto-google-search-results-on-my-website – 2013-02-10 01:48:26