如题,在form
表单中的action
属性的值可以写成目标相对路径或URL绝对路径。在W3School中是这样描述的:
Where to send the form-data when the form is submitted.
Possible values:
- An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
- A relative URL - points to a file within a web site (like action="example.htm")
现在我有下面的代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
</head>
<body>
<form method="post" id="aspnetForm" name="loginform" action="https://securecn.englishtown.com/login/handler.ashx">
<input name="username" type="hidden" value="xxxxxxxx"/>
<input name="password" type="hidden" id="et-password" value="123456">
<input name="p" type="hidden" id="txtPartner" value="Elef">
</form>
<script language="javascript">
document.loginform.submit();
</script>
</body>
</html>
为了保密我把username给替换了。
把这些保存成html文件,在本地直接双击打开,是可以跳转到https://securecn.englishtown.com/login/handler.ashx
并登陆成功的。
但,我把这个文件部署在服务器上,服务器会自动在文件所在的目录寻找login/handler.ashx
,显然我服务器上没有这个东西,于是报出404。
为什么部署在服务器上就不能跳转了呢?
不熟到服务器之后 你看看浏览器中的源码 有没有错