当前位置 : 主页 > 编程语言 > java >

JSP文本框加密解密转换

来源:互联网 收集:自由互联 发布时间:2021-06-25
%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%%@include file="/web/includes/taglibs.jsp" %!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"htmlhead%
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@include file="/web/includes/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%@include file="/web/includes/head.jsp" %>

<title>Tools</title>
<script type="text/javascript">
	function encode(){
		
		var pwd=$('#pwd').val();
		var formData=new FormData();
		formData.append("pwd",pwd);
		$.ajax({url:"${ctx}/sys/tools/pwd.do",
			data:formData,
			type:'POST',
			contentType:false,
			processData:false,
			success:function(result){
			var obj=JSON.parse(result);
		if(obj.status=='success'){
			$('#pwd_encoded').val(obj.msg);
		}else{
			$.messager.alert('提示',obj.msg,'error');
		}
	}})
	}
	
	function displayResult(){
		var x=document.getElementById("reset1").type;
		alert(x);
	}
</script>	
</head>
<body class="easyui-layout">
    <form>
	<table>
		<tr>
			<td align="right">密码明文:</td><td><input type="text" id="pwd" name="pwd" style="width:400px;height: 50px;"/></td>
		</tr>
		<tr>
			<td align="right">密码密文:</td><td><input type="text" id="pwd_encoded" name="pwd_encoded" style="width:400px;height: 50px;"/></td>
			<td align="center"><input type="button" style="width:100px" onclick="encode()" value="加密"/></td>
			<td align="center"><input type="reset" id="reset1 style="width:100px"  onclick="displayResult()" value="重置"/></td>
		</tr>
	</table>
	</form>	
</body>
</html>
网友评论