jsp:用frameset实现页面左边是表单,右边是表单提交的数据
时间: 2024-03-22 12:39:09 浏览: 27
您好,使用`frameset`实现页面左边是表单,右边是表单提交的数据,可以参考以下代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Frameset Example</title>
</head>
<frameset cols="50%,50%">
<frame src="form.html" name="formFrame">
<frame src="submit.html" name="submitFrame">
</frameset>
</html>
```
其中,`cols="50%,50%"`表示左边和右边各占50%的宽度。
然后,在`form.html`中编写表单代码,例如:
```html
<!DOCTYPE html>
<html>
<head>
<title>Form Example</title>
</head>
<body>
<form action="submit.html" method="post" target="submitFrame">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
```
在`submit.html`中编写表单提交后显示数据的代码,例如:
```html
<!DOCTYPE html>
<html>
<head>
<title>Submit Example</title>
</head>
<body>
<h1>Submitted Data:</h1>
<p>Name: <?php echo $_POST['name']; ?></p>
<p>Email: <?php echo $_POST['email']; ?></p>
</body>
</html>
```
这里使用了PHP语言来获取表单提交的数据,并在页面上显示出来。注意,`form`标签的`action`属性指定了表单提交到`submit.html`页面,`target`属性指定了表单提交后在哪个`frame`中显示结果。
希望能对您有所帮助!
相关推荐
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)