第一题
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>第一题</title> </head> <body> <div id="a"> <img src="图片/pic.gif" width="198" height="185"> </div> <script src="js/jquery-1.12.4.js"></script> <script type="text/javascript"> $("img").click(function () { $(this).css({"border":"2px solid red"}) }) </script> </body> </html>
第二题
$(document).ready(function () { $("h2").click(function () { $(".intro").show(); }) $("h3").click(function () { $(".intro1").show(); }) })
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>第二题</title> <script src="js/jquery-1.12.4.js"></script> <script src="js/第二题.js" type="text/javascript"></script> <style> h2{line-height: 45px; background: #999999; color: #ffffff;border: 1px solid;text-align: center } h3{line-height: 45px; background: #999999; color: #ffffff;border: 1px solid ;text-align: center } .intro{display: none;} .intro1{display: none} .intro p{text-indent: 2em;} </style> </head> <body> <h2>林徽因简介</h2> <div class="intro"> <p>林徽因,女,汉族,原名林徽音,出生于浙江杭州,祖籍福建福州。中国著名建筑家、诗人、作家。人民英雄纪念碑和中华人民共和国国徽深化方案的设计者</p> <p>林徽因是建筑师梁思成的第一任妻子。三十年代初,与夫婿梁思成用现代科学方法研究方法研究中国古代建筑,成为这个学术领域的开拓者。</p> </div> <h3 >主要作品</h3> <div class="intro1"> <p>《你是人间四月天》<br/> 《宝莲灯》<br/> 《九十九度中》</p> </div> </body> </html>