Changing images of elements using JavaScript
i have a container and below it, a table of 3 rows and a column and in each column, there is an image. i want to do such that onmouseover , the 开发者_运维百科container gets filled with that image.. help me do this..
here is how you will do it
$( window ).load(function()
{
$( 'img' ).hover(function()
{
var img_src = $( this ).attr( 'src' );
var $container = $( '#container' );
$container.html( '<img src="' + img_src + '" />' );
});
});
give the container the id 'container'
精彩评论