學習記錄

使用this 對元素進行處理動作

 

<html>
<head>
<title>Jquery-Sample-this </title>

<script type="text/javascript" src="./jquery.js"></script>

<script type="text/javascript">
function click()
{
    $('#div_picture').show();
}
function move()
{
    $('#div_picture').hide();
}
$(document).ready(function() {
    
    $('#div_picture').hide();
    
    $('.picture').click(function () {   
    url_id = $(this).attr("id");
    pictre_url = $(this).attr('value');
    $('#picture_id').attr('src', pictre_url)
    
    $(this).bind('click',click);
    $(this).bind('mouseout',move);
    });   
   
});

</script>
</head>
<body align="left">
<div id="show_picture_0" value="http://sstatic.net/so/img/logo.png" > show picture </div>
<div id="show_picture_1" value="http://imageshack.us/images/greylogo.png" > abcd </div>
<div id="div_picture" ><img id="picture_id" src=""></div  >
</body>
</html>


arrow
arrow
    全站熱搜

    yuanann 發表在 痞客邦 留言(0) 人氣()