同じウィンドウで写真を閲覧する方法はたくさんあります。この例では、JSを使用してIMGのSRC属性を取得して置き換えることを紹介します。これを必要とする友達はそれを参照できます。
<!doctype html public " - // w3c // dtd html 4.01 transitional // en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http- equiv = "content-type" content-type " <Title>タイトルを挿入しました</title> <style> h1 {position:aspolute; margin-left:150px;} ul {aspolute:asbolute; margin-top:50px; margin-left:80px;} li {float:left; list-style:none; padding:1em;} IMG {位置:絶対;マージントップ:100px;マージン左:100px;幅:1000px; height:600px;} p {position:absolute; margin-top:800px; margin-left:550px;} </style> <スクリプト> function showcat(a){var osrc = a.getattribution var oimg = document.getElementById( "IMG1"); oimg.setattribute( "src"、osrc); var op = document.getElementById( "p1"); var otxt = a.getAttribute( "title"); Op.ChildNodes [0] .Nodevalue = otxt ;; } </script> </head> <body> <h1> cat home </h1> <ul> <li> <a href = "img/1.jpg" onclick = "showcat(this); false;"> white cat </a> </li> <li> <a href = "img/2.jpg" <li> <a href = "img/3.jpg" onclick = "showcat(this); return false;"> cat </a> </li> </ul> <img id = "img1" src = "img/4.jpg"/> <pid = "p1"> cat写真</p> </html> </html> </html>