/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
搜索框效果function iniEvent() {
var txtSearch = document.getElementById("txtSearch");
txtSearch.onfocus = function () {
if (this.value == "请输入关键字" || this.value == "") {
this.value = "";
this.style.color = "black"; //修改文本框字体颜色
}
}
txtSearch.onblur = function () {
if (this.value == "请输入关键字" || this.value == "") {
this.value = "请输入关键字";
this.style.color = "red"; //修改文本框字体颜色
}
else {
this.style.color = "black";
}
}
}
查找
style="color:red" />