求解一个smarty,js和css的有关问题

WBOY
Release: 2016-06-13 10:21:09
Original
779 people have browsed it

求解一个smarty,js和css的问题
我从数据库取出最新的10条记录,然后通过samrty显示在页面上,每条记录都是一个div,然后用js控制当 鼠标悬停在div上时该div的背景颜色改变,现在的显示结果 只有第一个div是ok的 ,当鼠标悬停在其他div上时,却是第一个div的背景色改变了,其他的没变,请问这种情况该怎么解决?
 

js

function mouseOver(){
document.getElementById('diary').style.backgroundColor ="#C4C8CC";
}
function mouseOut(){
document.getElementById('diary').style.backgroundColor ="#F4F5F7";
}

页面上就是一个smarty二维数组的显示

------解决方案--------------------
把html代码发上来啊。从你的描述来看,不会是所有的div都设置了相同的id属性值吧?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!