利用info属性在页面输出姓名yangliu和学号2214800119
时间: 2024-05-06 20:20:29 浏览: 11
抱歉,由于我是一个AI语言模型,我无法在页面上输出信息。但是,如果您想在HTML页面上输出姓名和学号,可以使用以下代码:
```html
<div>
<p>姓名:Yang Liu</p>
<p>学号:2214800119</p>
</div>
```
或者,您可以使用JavaScript来获取元素并修改其内容:
```html
<div>
<p id="name">姓名:</p>
<p id="number">学号:</p>
</div>
<script>
document.getElementById("name").innerHTML += "Yang Liu";
document.getElementById("number").innerHTML += "2214800119";
</script>
```
这将在页面上输出姓名和学号。请注意,这只是示例代码,您需要根据自己的情况进行调整。
相关问题
用springboot 和vue实现一个登录页面
好的,下面是一个简单的使用Spring Boot和Vue.js实现登录页面的示例:
1. 创建Spring Boot项目
首先,我们需要创建一个Spring Boot项目。可以使用Spring Initializr来快速创建一个基本的Spring Boot项目。在创建项目时,选择Web、Security和Thymeleaf依赖。
2. 创建登录页面
在src/main/resources/templates目录下创建一个名为login.html的Thymeleaf模板文件,用于渲染登录页面。
```html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form method="post" action="/login">
<div>
<label for="username">Username:</label>
<input type="text" id="username" name="username"/>
</div>
<div>
<label for="password">Password:</label>
<input type="password" id="password" name="password"/>
</div>
<div>
<input type="submit" value="Login"/>
</div>
</form>
</body>
</html>
```
3. 创建登录表单
在src/main/resources/static目录下创建一个名为login.js的Vue.js文件,用于处理登录表单的交互。
```javascript
new Vue({
el: '#app',
data: {
username: '',
password: ''
},
methods: {
login: function () {
axios.post('/login', {
username: this.username,
password: this.password
}).then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
}
}
});
```
在login.html文件中引入login.js文件,并添加一个id为app的div元素。
```html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<div id="app">
<div>
<label for="username">Username:</label>
<input type="text" id="username" name="username" v-model="username"/>
</div>
<div>
<label for="password">Password:</label>
<input type="password" id="password" name="password" v-model="password"/>
</div>
<div>
<button v-on:click="login">Login</button>
</div>
</div>
<script src="/js/vue.js"></script>
<script src="/js/axios.min.js"></script>
<script src="/js/login.js"></script>
</body>
</html>
```
4. 创建登录控制器
在src/main/java目录下创建一个名为LoginController的控制器类,用于处理登录请求。
```java
@Controller
public class LoginController {
@GetMapping("/login")
public String login() {
return "login";
}
@PostMapping("/login")
public String doLogin(@RequestParam String username, @RequestParam String password) {
// TODO: 处理登录逻辑
return "redirect:/home";
}
}
```
5. 测试登录页面
运行Spring Boot应用程序并访问http://localhost:8080/login,应该会显示一个登录页面。输入用户名和密码并点击登录按钮,应该会将表单数据提交到后端,并重定向到/home页面(该页面未在本示例中实现,可以自行添加)。
这是一个简单的Spring Boot和Vue.js实现登录页面的示例,您可以根据需要进行扩展和改进。
创建一个 window 对象,底色为白色,标题为“草长莺飞二月天, 拂堤杨柳醉春烟”+你的学号。
很高兴回答你的问题。如果我理解正确的话,您希望我提供一个使用 Windows API 创建窗口的代码,并设置窗口背景色为白色,窗口标题为“草长莺飞二月天,拂堤杨柳醉春烟”,以及添加您的学号。以下是可能的代码示例:
```
#include <windows.h>
// 定义窗口名称、窗口大小等常量
const char* WINDOW_TITLE = "草长莺飞二月天,拂堤杨柳醉春烟";
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
const char* STUDENT_ID = "您的学号";
// 全局变量,用于保存窗口句柄
HWND g_hWnd = NULL;
// 窗口处理函数,处理窗口消息
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_PAINT:
{
// 绘制窗口底色为白色
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
HBRUSH whiteBrush = CreateSolidBrush(RGB(255, 255, 255));
FillRect(hdc, &ps.rcPaint, whiteBrush);
// 绘制学号
RECT textRect = { 10, 10, 200, 30 };
DrawText(hdc, STUDENT_ID, -1, &textRect, DT_SINGLELINE | DT_VCENTER);
// 结束绘制
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return 0;
}
// 主函数,创建窗口并运行消息循环
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// 注册窗口类
WNDCLASS wc = { 0 };
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
wc.lpszClassName = "MyWindowClass";
RegisterClass(&wc);
// 创建窗口并显示
g_hWnd = CreateWindow("MyWindowClass", WINDOW_TITLE, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL);
ShowWindow(g_hWnd, nCmdShow);
UpdateWindow(g_hWnd);
// 进入消息循环
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// 程序结束
return msg.wParam;
}
```
请注意,以上代码仅供参考,并未进行充分测试。如果您需要在生产环境中使用此代码,请仔细测试并进行必要的修改。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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)