<!DOCTYPE html> <html lang="ja-JP"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,user-scalable=yes,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.5"> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script> $(function(){ $("input").click(function(){ $("img[src$='"+ $(this).attr("value") + "']").css("display","inline-block"); $("img:not([src$='"+ $(this).attr("value") + "'])").css("display","none"); }); }); </script> </head> <body> <p> <input type="button" value="jpg"> <input type="button" value="gif"> <input type="button" value="png"> </p> <p> <img src="img/jpg.jpg"> <img src="img/gif.gif"> <img src="img/png.png"> </p> </body> </html>