如何在jsp页面元素中使用js中的变量?
我现在有这样一个页面
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script language="javascript" src="default.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var mvbwebkey = "be936b2a75f01891";
var frienduser = "admin";
var friendpass = d.MD5("12345a");
function login() {
var url = "http://192.168.100.20/admin/config.php?mvbwebkey="
+ mvbwebkey + "&frienduser=" + frienduser + "&friendpass="
+ d.MD5(friendpass) + "&random=" + Math.random();
}
</script>
</head>
<body>
<form name="mvb2000auth"
action="http://192.168.100.20/admin/config.php" method="post">
<input type="text" name="webkey" value="be936b2a75f01891" />
<input type="text" name="frienduser" value="admin" />
<input type="text" name="friendpass" value="" />
<input type="submit" value="登陆" />
</form>
</body>
</html>
<input type="text" id="friendpassId" name="friendpass" value="" />
document.getElementById("friendpassId").value = friendpass;