开发者

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'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜