the code for jQuery fn funciton

example code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
<script src="jquery-1.4.min.js" type="text/javascript"></script>  


<script type="text/javascript">


    $.fn.jQueryAlert = function() {

        window.alert($(this).attr('id'));
    }


    $(document).ready(function() {

        $('#jQuery-1').jQueryAlert();
    });

</script>
</head>
<body>
      <div id="jQuery-1"> use $.fn </div>
</body>
</html>

 

posted @ 2011-11-10 21:05  来自非洲大草原的食人虎  阅读(114)  评论(0)    收藏  举报