<title>js第三节</title>
<style type="text/css">
div
{
width:100px;
height:100px;
background:pink;
box-shadow:0px 0px 10px red;
border:2px solid blue;
margin-top:15px;
word-wrap:break-word;
}
</style>
</head>
<script type="text/javascript">
window.onload=function()
{
var atex=document.getElementById("tex");
var abut=document.getElementById("but");
var adiv=document.getElementById("div1");
abut.onclick=function()
{
adiv.innerHTML=atex.value;
}
}
</script>
<body>
<input type="text" value="" id="tex">
<input type="button" value="点击提交" id="but">
<div id="div1">asdasda</div>
</body>
文本框提交后值赋给innerHTML--------------设计师零张,布布扣,bubuko.com
时间: 2024-10-09 23:37:38