Javascript 把东西放在自己的滚动框里

Javascript 把东西放在自己的滚动框里,javascript,html,Javascript,Html,所以我在做一个无聊的点击游戏。对于所有你能买到的东西,我想把它们放在右边的盒子里。基本上,你不需要向下滚动整个页面,只需要在它自己的小框中向下滚动即可。我该怎么把代码放在那样的盒子里?基本上,它就像cooike clicker右边的框一样,yopu可以滚动所有你能滚动的东西,但没有向下滚动真正的页面。就像窗户里面的窗户 我想把这段文字放在你可以向下滚动的窗口里,这样就不会占用太多的空间 <img src="http://i788.photobucket.com/albums/yy168/B

所以我在做一个无聊的点击游戏。对于所有你能买到的东西,我想把它们放在右边的盒子里。基本上,你不需要向下滚动整个页面,只需要在它自己的小框中向下滚动即可。我该怎么把代码放在那样的盒子里?基本上,它就像cooike clicker右边的框一样,yopu可以滚动所有你能滚动的东西,但没有向下滚动真正的页面。就像窗户里面的窗户 我想把这段文字放在你可以向下滚动的窗口里,这样就不会占用太多的空间

<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_MomObject_zps20d68d83.png" alt="mom" />
<button style="background-color:Purple; color:red; border:red; font-size:15px;" type="button" onclick="buyMom()">Buy 1 mom</button>
<p>Moms:+1 animals per second
    <br>(Makes baby animals with mom powers)</p>
<div id="momCount">0</div>
<div id="momPrice">50</div>
<br>
<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Incuobject_zpsee0cee76.png" alt="Incubator" />
<button style="background-color:lightcoral; color:purple; border:red; font-size:15px;" type="button" onclick="buyIncu()">Buy 1 incubator</button>
<p>Incubator:+10 animals per second
    <br>(Just the right growing conditions)</p>
<div id="incuCount">0</div>
<div id="incuPrice">150</div>
<br>
<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Farmobject_zps29b6cd87.png" alt="Farm" />
<button style="background-color:red; color:purple; border:red; font-size:15px;" type="button" onclick="buyFarm()">Buy 1 farm</button>
<p>Farms:+50 animals per second
    <br>(More room for more reproduction!)</p>
<div id="farmCount">0</div>
<div id="farmPrice">500</div>
<br>
<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Factoryobject_zps8aa2f150.png" alt="factory" />
<button style="background-color:yellow; color:blue; border:red; font-size:15px;" type="button" onclick="buyFactory()">Buy 1 factory</button>
<p>Factorys:+100 animals per second
    <br>(Genetic baby animals!)</p>
<div id="factoryCount">0</div>
<div id="factoryPrice">1000</div>
<br>



<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Clonreobject_zps0f89c829.png" alt="Cloner" />
<button style="background-color:orange; color:red; border:red; font-size:15px;" type="button" onclick="buyClone()">Buy 1 cloner</button>
<p>Cloners:+500 animals per second
    <br>(Cloning babys in the clone-o-matic)</p>
<div id="cloneCount">0</div>
<div id="clonePrice">2000</div>
<br>
<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Dnaobject_zps32b2a5e4.png" alt="Dna" />
<button style="background-color:lime; color:black; border:red; font-size:15px;" type="button" onclick="buyDna()">Buy 1 Dna Changer</button>
<p>Dna Changer:+800 animals per second
    <br>(Changing pesky humans into animals!)</p>
<div id="dnaCount">0</div>
<div id="dnaPrice">8000</div>
<br>



<p>================================</p>
<img src="http://i788.photobucket.com/albums/yy168/Boone_Losche/th_Animalfarm_zps5c2bc06a.png" alt="Af" />
<button style="background-color:red; color:yellow; border:red; font-size:15px;" type="button" onclick="buyAf()">Invoke AиIMAL FAяM</button>
<p>Protocol ANIMAL FAяM:+2000 animals per second comrade
    <br>(four legs not two)</p>
<div id="afCount">0</div>
<div id="afPrice">15000</div>
<br>

<p>================================</p>

买一个妈妈
妈妈:每秒+1只动物

(用妈妈的力量制作小动物)

0 50
================================

购买1个孵化器 孵化器:+10只动物/秒
(恰到好处的生长条件)

0 150
================================

买一个农场 农场:+50只动物/秒
(更多复制空间!)

0 500
================================

购买一家工厂 工厂:+100只动物/秒
(遗传的小动物!)

0 1000
================================

购买1台克隆机 克隆人:+500只动物/秒
(在clone-o-matic中克隆婴儿)

0 2000
================================

购买1台Dna转换器 Dna转换器:+800只动物每秒
(把讨厌的人变成动物!)

0 8000
================================

调用一个iimal FAØM 协议动物法M:+2000只动物每秒同志
(四条腿不是两条腿)

0 15000
================================


若要制作插入框,请在需要的地方放置一个div,然后将溢出设置为自动。这就像一个迷你可滚动窗口

设置HTML:

<div id = "frameright">
<p>Your Stuff</p>
</div>

那是行不通的。它刚好与图片重叠。我放错了吗?你能发个短信吗。
#frameright {
position:absolute; 
top:0px; 
left:400px; /*Change the position*/ 
width:250px; /*Width of right frame div*/
overflow:auto; /*Lets you scroll*/
}