我是初學HTML5和Javascript的用戶,我想創建一個基本功能,使用事件交換部分的位置。如何使用javascript替換部分
函數1正在工作,將部分「con」交換到頂部,但函數2不起作用。
請有人能幫助我嗎?
function swap1()
{
document.getElementById("top").style.position = "absolute";
document.getElementById("con").style.top = "50px";
}
function swap2()
{
document.getElementById("con").style.position = "fixed";
document.getElementById("top").style.bottom = "300px";
}
<section id="top" onmousedown="swap1()">
<video width="500" height="500" controls>
<source src="http://techslides.com/demos/sample-videos/small.mp4" type=video/mp4>
</video>
</section>
<section id="con" onmouseover="swap2()">
<hr>
<p>Text.</p>
</section>
得到它,謝謝! – h1ghland3r