六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 32|回复: 0

javascript实现输入框输入内容不能重复

[复制链接]

升级  93%

145

主题

145

主题

145

主题

举人

Rank: 3Rank: 3

积分
479
 楼主| 发表于 2013-1-29 09:03:00 | 显示全部楼层 |阅读模式
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
function tt(){
           var psd1=document.getElementById("psd1").value;
           var psd2=document.getElementById("psd2").value;
           if(psd1=psd2){
          alert("输入框内容重复了!");
          return false;
    }
          return true;

        }
</script>
</head>

<body>
<form name="form1" >
   输入框一:<input type="text" name="psd1" value="123456"/><br/>
   输入框二:<input type="text" name="psd2" value="123"/><br/>
   检查输入框:
   <input type="button"  name="txt2"="检查"/>



<td><input type ="submit"></td>
</table>
</form>
</body>
</html>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表