我正在寻找如何添加两个按钮“你觉得粘在墙上的棍子像蜂蜜一样。旁边是几块石头。部分。这两个按钮出现在声明的正下方。我该怎么做呢?这是当前的代码:
<script>
function one()
{
var newButton1 = '<button id="btnTwo" onclick="two()" >Pick up stick</button>';
var newButton2 = '<button id="btnThree" onclick="three()">Leave it
there</button>';
document.getElementById("a").style.width = '330px';
document.getElementById("a").innerHTML="<div style='width:220px;float:left'>You feel
something on the ground, and you think it's a stick.</div>"+newButton1+newButton2;
var myButton = document.getElementById('btnOne');
myButton.onclick = four;
}
function two()
{
document.getElementById("b").innerHTML="You pick up the stick. It might be useful for
something.";
document.getElementById("inventory").style.display = "block";
document.getElementById("btnThree").style.display = 'none';
document.getElementById("btnTwo").style.display = 'none';
}
function three()
{
document.getElementById("c").innerHTML="You leave the stick on the ground and continue
on.";
document.getElementById("btnTwo").style.display = 'none';
document.getElementById("btnThree").style.display = 'none';
}
function four()
{
document.getElementById("d").innerHTML="You feel a stick stuck to the wall with
something like honey. Next to it is a few rocks.";
}
</script>
<div style="margin-left:15px; width:200px; margin-top:100px;">
<button id="btnOne" onclick="one()">Feel around the cave</button>
</div>
<div id="entire" style="margin-left:250px; margin-top:-19px; width:200px;
height:400px;">
<div id="d"></div>
<div id="c"></div>
<div id="b"></div>
<div id="a"></div>
</div>
<div style="height:400px;">
<div id="inventory" style="margin-left:550px; width:100px; height:100px; margin-
top:-400px; border: 1px solid #ffffff; display:none;">
<div style="margin-left:10px; margin-top:10px;">Sticks: 1</div>
</div>
</div>