Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Sets src attribute from title attribute on the image

< html>   <head>     <script type="text/javascript" src="js/jquery-1.3.2.js"></script>     <script type="text/javascript">         $(document).ready(function(){                 $("img").attr("src", function() {                    return "/images/" + this.title;                  });         });     </script>   </head>   <body>     <body>       <img title="a.gif"/>     </body> </html>