当前位置: 代码迷 >> JavaScript >> 一个输入框变色的效果如何做
  详细解决方案

一个输入框变色的效果如何做

热度:47   发布时间:2012-03-06 20:47:55.0
一个输入框变色的效果怎么做?
http://armory.wowtaiwan.com.tw/

就像这个网站,   点 "搜索armory "后字体消失,   然后输入框变色
离开输入框后再重新写 "搜索armory "

------解决方案--------------------
背景中那个绕圈圈滴亮点儿是 flash
http://armory.wowtaiwan.com.tw/images/searchbox.swf

代码如下,L@_@K

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<title> new document </title>
<meta name= "generator " content= "editplus " />
<meta name= "author " content= "yixianggao@126.com " />
<meta name= "keywords " content= "javascript " />
<meta name= "description " content= "for javascript region of csdn " />
<style type= "text/css ">
.highlight {
border: 1px solid red;
}
</style>
<script type= "text/javascript ">
<!--
function checkClear() {
if (document.formSearch.searchQuery.value == document.formSearch.searchQuery.defaultValue)
document.formSearch.searchQuery.value = " ";
}

function checkBlur() {
if (document.formSearch.searchQuery.value == " ")
document.formSearch.searchQuery.value = document.formSearch.searchQuery.defaultValue;
}
//-->
</script>
</head>

<body>
<form name= "formSearch ">
<input maxlength= "72 " size= "16 " onmouseover= "this.className = 'highlight ' " onmouseout= "this.className = ' ' " onBlur= "javascript: checkBlur(); " onFocus= "javascript: checkClear(); " value= "&#25628;&#23563;The Armory " name= "searchQuery " type= "text ">
</form>
</body>
</html>
  相关解决方案