css|express| Object | Control problem Description: Using CSS styles We know that you can define the class attribute of a batch of objects to specify the same style to unify the interface. But how do you unify events of the same type of objects? For example: The interface has countless <img src= "http://edu.cnzz.cn/newsinfo/**.jpg" > How to implement the mouse through this picture, the picture of Src become **_over.jpg?
Workaround: Use CSS expression method,
specific implementation to see. The writing of CSS:
/* Replace picture css*/
#imgScript {/* Here you use object IDs to match styles, or you can define a CSS function */
Star:expression (
onmouseover = function ()
{
/* Replacement picture */
if (this.hover!= null) {
this.name = this.src;
this.src = This.src.replace ('. jpg ', ' _over.jpg ');
This. HASCHG = 1;
}
},
onmouseout = function ()
{
/* Restore the original picture * *
if (this. HASCHG!= null) {
this.src = this.name;
this. HASCHG = null;
}
}
)
}/*end imgscript*/
Application-style IMG:
Please put the mouse on the a.jpg to see the effect