日期:2014-05-16 浏览次数:20499 次
function nameDisa(){
var v;
v=document.getElementByName("_name").value;
if (v=="昵称"){document.getElementByName("_name").value=""}
}
function nameShow(){
var v;
v=document.getElementByName("_name").value;
if (v==""){document.getElementByName("_name").value="昵称"}
}
<input type="text" class="name" name="_name" value="昵称" onfocus="nameDisa();"onblur="nameShow();"/>
<input value="昵称" onfocus="if (value =='昵称'){value =''}" onblur="if (value ==''){value='昵称'}" />
<script >
function nameDisa(el){
if (el.value==el.title) el.value='';
}
function nameShow(el){
if(!el.value) el.value=el.title;
}
</script>
<input type="text" title='昵称' value="昵称" onfocus="nameDisa(this);"onblur="nameShow(this);"/>
<input type="text" title='用户名' value="用户名" onfocus="nameDisa(this);"onblur="nameShow(this);"/>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function nameDisa(){