在div分层中加入一个input按钮,点击input按钮,想在div层中显示“Google在办公工具软件领域正式向微软发起了挑战”,怎样实现呢?下面我
<div id= "d1 " style= "Z-INDEX: 3; LEFT: 100px; WIDTH: 554px; POSITION: absolute; TOP: 600px; HEIGHT: 200px ">
<input id= "btnView1 " type= "button " value= "查看1 " onclick= "return btnView1_onclick() " />
</div>
----------
function btnView1_onclick() {
document.write( "Google在办公工具软件领域正式向微软发起了挑战 ");
}
这样只在网页的左上角显示,怎样让它显示在div层中呢?
------解决方案-------------------- <html>
<head> </head>
<body>
<div id= "d1 " style= "display:none;Z-INDEX: 3; LEFT: 100px; WIDTH: 554px; POSITION: absolute; TOP: 600px; HEIGHT: 200px ">
</div>
<input id= "btnView1 " type= "button " value= "查看1 " onclick= "return btnView1_onclick() " />
<script>
function btnView1_onclick() {
document.all.d1.innerText= "Google在办公工具软件领域正式向微软发起了挑战 ";
document.all.d1.style.display= "block ";
}
</script>
</body>
</html>