通過(guò)onmouseover選項(xiàng)卡實(shí)現(xiàn)img圖片的變化
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>選項(xiàng)卡實(shí)現(xiàn)img圖片的變換</title>
<style type="text/css">
#main{ height:420px; width:400px;}
#head{
width:400px;
height:52px;
position:absolute;
left:10px;
top: -12px;
background-color:green;
}
#head li{ float:left; list-style:none; width:85px;}
#content{
width:400px;
height:350px;
background-color:#FC6;
text-align:center;
position:absolute;
top:36px;
left: 10px;
}
</style>
</head>
<body>
<div id="main">
<div id="head">
<ul>
<li id="tab1" onmouseover="show(1)" style="background-color:#FFF">圖片一</li>
<li id="tab2" onmouseover="show(2)">圖片二</li>
<li id="tab3" onmouseover="show(3)">圖片三</li>
<li id="tab4" onmouseover="show(4)">圖片四</li>
</ul>
</div>
<div id="content">
<p id="p1"><img src="圖片0"/></p>
<p id="p2" style="display:none;"><img src=“圖片1”></p>
<p id="p3" style="display:none;"><img src="圖片2" height="320px;"/></p>
<p id="p4" style="display:none;"><img src="圖片3"/></p>
</div>
</div>
</body>
<script>
function show(n){
for(var i=1;i<=4;i++){
document.getElementById("tab"+i).style.backgroundColor='green';
document.getElementById("p"+i).style.display='none';
//display實(shí)現(xiàn)內(nèi)容的隱藏與否的控制,當(dāng)為none是,隱藏
}
document.getElementById("tab"+n).style.backgroundColor='white';
document.getElementById("p"+n).style.display='block';
//當(dāng)block時(shí),隱藏的即可顯示
}
</script>
</html>
- js 阻止子元素響應(yīng)父元素的onmouseout事件具體實(shí)現(xiàn)
- JS小功能(onmouseover實(shí)現(xiàn)選擇月份)實(shí)例代碼
- onmouseover和onmouseout的一些問(wèn)題思考
- js ondocumentready onmouseover onclick onmouseout 樣式
- 兼容ie和firefox的鼠標(biāo)經(jīng)過(guò)(onmouseover和onmouseout)實(shí)現(xiàn)--簡(jiǎn)短版
- js下關(guān)于onmouseout、事件冒泡的問(wèn)題經(jīng)驗(yàn)小結(jié)
- onmouseover事件和onmouseout事件全面理解
相關(guān)文章
js簡(jiǎn)單判斷移動(dòng)端系統(tǒng)的方法
這篇文章主要介紹了js簡(jiǎn)單判斷移動(dòng)端系統(tǒng)的方法,通過(guò)JavaScript的navigator.userAgent相關(guān)屬性判斷訪問(wèn)端的系統(tǒng)類型,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2016-02-02微信小程序把百度地圖坐標(biāo)轉(zhuǎn)換成騰訊地圖坐標(biāo)過(guò)程詳解
這篇文章主要介紹了微信小程序把百度地圖坐標(biāo)轉(zhuǎn)騰訊地圖坐標(biāo)過(guò)程詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-07-07JavaScript高級(jí)程序設(shè)計(jì) 錯(cuò)誤處理與調(diào)試學(xué)習(xí)筆記
JavaScript高級(jí)程序設(shè)計(jì) 錯(cuò)誤處理與調(diào)試學(xué)習(xí)筆記,學(xué)習(xí)js的朋友可以參考下。2011-09-09arrayToJson將數(shù)組轉(zhuǎn)化為json格式的js代碼
arrayToJson將數(shù)組轉(zhuǎn)化為json格式的js代碼,需要的朋友可以參考下。2010-10-10layui之table checkbox初始化時(shí)選中對(duì)應(yīng)選項(xiàng)的方法
今天小編就為大家分享一篇layui之table checkbox初始化時(shí)選中對(duì)應(yīng)選項(xiàng)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-09-09layui當(dāng)點(diǎn)擊文本框時(shí)彈出選擇框,顯示選擇內(nèi)容的例子
今天小編就為大家分享一篇layui當(dāng)點(diǎn)擊文本框時(shí)彈出選擇框,顯示選擇內(nèi)容的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-09-09JS實(shí)現(xiàn)屏蔽shift,Ctrl,alt等功能鍵的方法
這篇文章主要介紹了JS實(shí)現(xiàn)屏蔽shift,Ctrl,alt等功能鍵的方法,涉及javascript針對(duì)鍵盤(pán)按鍵的獲取與操作技巧,需要的朋友可以參考下2015-06-06JavaScript中手動(dòng)實(shí)現(xiàn)Array.prototype.map方法
在前端開(kāi)發(fā)中,我們經(jīng)常需要對(duì)數(shù)組進(jìn)行操作和處理,本文主要介紹了JavaScript中手動(dòng)實(shí)現(xiàn)Array.prototype.map方法,具有一定的參考價(jià)值,感興趣的可以了解一下2024-02-02js實(shí)現(xiàn)文件上傳功能 后臺(tái)使用MultipartFile
這篇文章主要為大家詳細(xì)介紹了純js實(shí)現(xiàn)最簡(jiǎn)單的文件上傳功能,后臺(tái)使用MultipartFile,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-09-09