获取各个文本框的内容,将获取的字符串整合到textarea显示
代码
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- <link rel="stylesheet" type="text/css" href="style.css"> -->
<script src="jisuanqi.js"></script>
<style>
.num1{
width:30px;
}
</style>
</head>
<body>
<input class="num1" id="num1" type="text">+
<input class="num1" id="num2" type="text">=
<input class="num1" id="num3" type="text" >
<input id="sum" type="submit" value="运算" onclick="calc()">
</body>
</html>
CSS:
.top{
margin-top:10px;
margin-left:5px;
width:680px;
height:112px;
/* background-color:#cccccc; */
}
.middle{
width:680px;
height:45px;
margin-left:5px;
/* background-color:#aaaaaa; */
}
.bottom{
width:680px;
height:200px;
margin-left:5px;
/* background-color:#3355bb; */
}
.tt{
width:150px;
height:112px;
margin-right:5px;
float:left;
}
.tt1{
width:160px;
height:112px;
margin-right:20px;
font-size:16px;
float:left;
}
.text1{
margin-top:7px;
}
.o{
margin-top:5px;
border:solid 1px lightgray;
}
.button{
width:77px;
height:30px;
margin-left:450px;
}
.textarea{
width:673px;
height:200px;
font-size:15px;
}
JavaScript:
function print(){
//读取文本框输入的值
adress=document.getElementById('adress').value;
company=document.getElementById('company').value;
money=document.getElementById('money').value;
unit=document.getElementById('unit').value;
type=document.getElementById('type').value;
name=document.getElementById('name').value;
production=document.getElementById('production').value;
str=adress+"最大的"+type+company+"倒闭了。XXX老板"+name+"吃喝嫖赌,欠下"+money+"个亿,带着他的家眷跑路了!我们没有办法,拿着"+production+"抵工资!原价都是一"+unit+"多、两"+unit+"百多的"+production+",现在全部只卖二十块,统统只要二十块!"+name+"XXX,我们辛辛苦苦给你工作大半年,你不发工资,你还我们血汗钱钱!"
document.getElementById('text').value=str;
}