网页设计,DIV+CSS ,JS脚本的问题????我改一下JS脚本哪,就不用老是写那个1呀2呀等这些数字了?帮我看下吧谢
<!--产品列表--><scriptlanguage="javascript">functionshowBg(index){document.getElementById...
<!-- 产品列表-->
<script language="javascript">
function showBg(index){
document.getElementById("big"+index).style.backgroundColor='#FFF8E1';
}
function hideBg(index){
document.getElementById("big"+index).style.backgroundColor='';
}
</script>
<div class="dakuang">
<div id="big1" onmouseover="showBg(1)" onmouseout="hideBg(1)" class="xiaokuang">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big2" onmouseover="showBg(2)" onmouseout="hideBg(2)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big3" onmouseover="showBg(3)" onmouseout="hideBg(3)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
</div>
<!-- 产品列表--> 展开
<script language="javascript">
function showBg(index){
document.getElementById("big"+index).style.backgroundColor='#FFF8E1';
}
function hideBg(index){
document.getElementById("big"+index).style.backgroundColor='';
}
</script>
<div class="dakuang">
<div id="big1" onmouseover="showBg(1)" onmouseout="hideBg(1)" class="xiaokuang">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big2" onmouseover="showBg(2)" onmouseout="hideBg(2)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big3" onmouseover="showBg(3)" onmouseout="hideBg(3)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
</div>
<!-- 产品列表--> 展开
展开全部
试试这个
<script language="javascript">
function showBg(s){
s.style.backgroundColor='#FFF8E1';
}
function hideBg(s){
s.style.backgroundColor='';
}
</script>
<div class="dakuang">
<div id="big1" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big2" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big3" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
</div>
<script language="javascript">
function showBg(s){
s.style.backgroundColor='#FFF8E1';
}
function hideBg(s){
s.style.backgroundColor='';
}
</script>
<div class="dakuang">
<div id="big1" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big2" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
<div id="big3" onmouseover="showBg(this)" onmouseout="hideBg(this)" class="xiaokuang02">
<p class="tu"><a href="#" title="时尚内衣"><img src="images/tu_01.jpg" alt="时尚内衣" /></a></p>
<p class="txt">售价:<span class="price">25.60</span> 原价:<del>39.90</del></p>
<p class="txt"><a href="#">爱的阶梯精装男士三角内裤</a></p>
</div>
</div>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询