1.单击图片显示图片边框
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>单击图片显示边框</title> <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script> </head> <body> <div> <img src="../初识jQuery/pic.gif"> </div> </body> <script> $(function () { $("img").click(function () { $("img").css("border","1px solid black") }) }) </script> </html>
2.单击链接显示内容
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>作品</title> <style> h1{ background: #333333; color: #FFFFED; text-align: center; } div{ text-align: center; } #a p:nth-of-type(1){