写一个编辑框显示在背景图片之上,输入内容调用huoqu(id)方法
时间: 2024-03-14 09:45:57 浏览: 19
好的,这是一个常见的HTML/CSS/JavaScript实现编辑框在背景图片上方的代码,同时调用了一个名为`huoqu`的方法:
```html
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("背景图片的URL");
background-size: cover;
background-position: center;
}
#editor {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80%;
height: 200px;
padding: 10px;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 0.5);
border: none;
font-size: 16px;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<textarea id="editor"></textarea>
<script>
function huoqu(id) {
var content = document.getElementById(id).value;
// 在这里可以对获取到的内容进行处理
console.log(content);
}
</script>
</body>
</html>
```
你可以将上面代码中的`背景图片的URL`替换为你所使用的背景图片的URL,然后将整个代码复制到一个HTML文件中,用浏览器打开即可看到效果,同时可以在编辑框中输入内容并调用`huoqu`方法进行处理。