1. 用JavaScript
正确的做法应该是:
<script type="text/javascript">
function goToClient(username,password){
window.location.href="client.jsp?username=" + username + "&password=" + password;
}
</script>
<a href="#" οnclick="javascript:goToClient('u','p');">jsfdh</a>
这样用户在IE或FireFox中地址栏是看不到连接的地址,只能看到#。
2. 用Form Submit的方法
<form action="client.jsp" method="post" name="client">
<input type="hidden" name="username" value="u" />
<input type="hidden" name="password" value="p" />
<a href="#" οnclick="document.forms['client'].submit();">jsfdh</a>
</form>
<!-- 注意forms['client']中,'client'是那个form的名字-->
<form name="form1" action="client.jsp" method="post">
<input type="hidden" id="RID" name="RoomID" value="">
<input type="hidden" id="RTYPE" name="RoomType" value="">
<input type="hidden" id="CID" name="CommpanyID" value="">
<input type="hidden" id="DOID" name="doid" value="">
</form>
<script>
function forwardTo(rid, rtype, cid, doid){
document.getElementById('RID').value=rid;
document.getElementById('RTYPE').value=rtype;
document.getElementById('CID').value=cid;
document.getElementById('DOID').value=doid;
form1.submit();
}
</script>
<a href="#" οnclick="forwardTo(55,0,55,19)">jsfdh</a>