在html中如何获取表单提交的数据

a.html:

<!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>

</head>

<body>

	<form>

	 姓名:<input name="a" type="text">

	 	<input type="button" onclick="window.location.href='b.html?a='+a.value" value="提交">

	</form>

</body>

</html>

b.html:

<!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>

</head>

<body>

<script type="text/javascript">

	var wo1=String(document.location);

	var wo2=wo1.indexOf("=");

	var wo3=wo1.substring(wo2+1,wo1.length);

	document.write("欢迎您:"+wo3);

</script>

</body>

</html>

 参考自:

http://bbs.csdn.net/topics/60254271

 

你可能感兴趣的:(html)