感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>主页</title>
<style>
body{
display:flex;
}
#danmu{
position:relative;
width:400px;
height:200px;
background-color:black;
float:left;
.message{
margin-left:50px;
input{
margin:20px;
.msgbox{
position:absolute;
right:20px;
top:20px;
color:white;
</style>
</head>
<body>
<div id="danmu">
</div>
<div class="message">
颜色:<input type = "text" id="color"/><br/>
内容:<input type = "text" id="msg"/><br/>
<button type="button" onclick="send()">
发送
</button>
</body>
</html>
xxxxxxxxxx
var Danmu = function(text,color){
this.text = text;
this.color = color;
function send(){
var text = document.getElementById("msg");
var color = document.getElementById("color");
//var danmu = new Danmu(text.value,color.value);
var msgbox = document.createElement("span");
var msg = document.createTextNode(text.value);
msgbox.appendChild(msg);
var att=document.createAttribute("class");
att.value="msgbox";
msgbox.setAttributeNode(att);
var danmu = document.getElementById("danmu");
danmu.appendChild(msgbox);
// setTimeOut(move(msgbox),3000);
function move(obj){
obj.style.right = "400px";
输入 CSS 代码……