當前位置:成語大全網 - 新華字典 - html使用onmouseover事件怎麽設置鼠標移動到圖片或者文字上在旁邊彈出壹個圖片介紹

html使用onmouseover事件怎麽設置鼠標移動到圖片或者文字上在旁邊彈出壹個圖片介紹

//設置壹個div,但是默認卻是隱藏起來的。

.s1{

position: absolute;

display: none;

}

// js

function show(){

document.getElementById("s1").style.display="block";

}

function dis(){

document.getElementById("s1").style.display="none";

}

<img src="small.bmp" onmouseover="show();" onmouseout="dis();">

<div class="s1" id="s1"><img src="big.bmp"></div>

要是想彈出文字介紹 把s1裏面的img換成字就行了,或者簡單點就在第壹個img上加壹個alt的屬性,鼠標放在上邊也有顯示。