鼠标控制显示或隐藏。
在IE中运行正常,但是在火狐下你们可以试验一下。
<dl class="beator" id="Images_hot">
<dt style="padding-top:15px;">热门商品</dt>
<dd style="display:none;">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank"><img src="/UserFiles/GoodsPic/1100010070002/1100010070002_1.jpg"
width="150" height="150"></a></dd>
<dd onmouseover="Images_change(this)">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank">金原水解胶原蛋白粉</a></dd><dd style="display:none;">
</dl>
<script type="text/javascript">
function Images_change(obj) {
obj.style.display = "none";
for (var i = 0; i < $("#Images_hot dd").length; i++) {
if (i % 2 == 0) {
if ($("#Images_hot dd")[i].style.display == "block") {
$("#Images_hot dd")[i + 1].style.display = "block";
}
$("#Images_hot dd")[i].style.display = "none";
}
}
obj.previousSibling.style.display = "block";
}
if ($("#Images_hot dd").length > 1) {
$("#Images_hot dd")[0].style.display = "block";
$("#Images_hot dd")[1].style.display = "none";
}
</script>
在IE中运行正常,但是在火狐下你们可以试验一下。
<dl class="beator" id="Images_hot">
<dt style="padding-top:15px;">热门商品</dt>
<dd style="display:none;">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank"><img src="/UserFiles/GoodsPic/1100010070002/1100010070002_1.jpg"
width="150" height="150"></a></dd>
<dd onmouseover="Images_change(this)">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank">金原水解胶原蛋白粉</a></dd><dd style="display:none;">
</dl>
<script type="text/javascript">
function Images_change(obj) {
obj.style.display = "none";
for (var i = 0; i < $("#Images_hot dd").length; i++) {
if (i % 2 == 0) {
if ($("#Images_hot dd")[i].style.display == "block") {
$("#Images_hot dd")[i + 1].style.display = "block";
}
$("#Images_hot dd")[i].style.display = "none";
}
}
obj.previousSibling.style.display = "block";
}
if ($("#Images_hot dd").length > 1) {
$("#Images_hot dd")[0].style.display = "block";
$("#Images_hot dd")[1].style.display = "none";
}
</script>
<dt style="padding-top:15px;">热门商品</dt>
<dd style="display:none;">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank"><img src="/UserFiles/GoodsPic/1100010070002/1100010070002_1.jpg"
width="150" height="150"></a></dd>
<dd onmouseover="Images_change(this)">
<a title="金原水解胶原蛋白粉" href="/Shop/Goods-1100010070002.html" target="_blank">金原水解胶原蛋白粉</a></dd><dd style="display:none;"> </dl>楼主这个代码,标签不用结束的嘛!
FF下对HTML的标签检查很严格的!不像IE!
if (obj.innerHTML == $("#Images_hot dd")[i].innerHTML) {
$("#Images_hot dd")[i - 1].style.display = "block";
}
<tr>
<th>1</th>
<td>1</td>
</tr>
<tr>
<th>2</th>
<td>2</td>
</tr>
<tr style="display:block">
<th>2</th>
<td>2</td>
</tr>
</table>
乱了