开发者

Changing images of elements using JavaScript

开发者 https://www.devze.com 2023-01-11 10:04 出处:网络
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.. h

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

精彩评论

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