<html> <head> <title>TEST</title> <link rel="stylesheet" type="text/css" href="style.css"/> <script src="Image1.js"></script> <script src="Image2.js"></script> </head> <body> <img id="defaultPic" src="microsoftLogo1.jpg" /><br/> <img id="subPic1" src="microsoftLogo1.jpg" onclick="getImage1()"/><br/> <img id="subPic2" src="microsoftLogo2.jpg" onclick="getImage2()"/> </body> </html>
*{ margin: 0; padding: 0; } #defaultPic { border: 1px solid black; margin: 5px; width: 200px; height: 200px; } #subPic1{ border: 1px solid black; margin: 5px; width: 50px; height: 50px; } #subPic2{ border: 1px solid black; margin: 5px; width: 50px; height: 50px; }
function getImage1(){ var img = document.getElementById("subPic1").src; document.getElementById("defaultPic").src = img; } function getImage2(){ var img = document.getElementById("subPic2").src; document.getElementById("defaultPic").src = img; }
</<pre lang="CSS"><pre lang="CSS"><pre lang="CSS">
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)