Tình hình là mình đã làm theo sự hướng dẫn của cô nhưng không thấy nó hoạt động. Ai coi giúp mình lỗi sai với nha.
- Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function changeImage(oValue) {
var car = document.getElementById("imgCar");
car.src = "images/" +oValue + ".jpg";
}
function Car(ten, doi, xuat, gia) {
this.tenXe = ten;
this.doiXe = doi;
this.xuatXu = xuat;
this.giaBan = gia;
this.ThongTin = function () {
var str = "Tên xe: " + this.tenXe;
str += "\nĐời Xe: " + this.doiXe;
str += "\nXuất xứ: " + this.xuatXu;
str += "\nGía bán: " + this.giaBan;
return str;
}
}
</script>
<style>
* {
margin:auto;
}
#main {
width:700px;
height:500px;
border:solid thin #03c
text-align:center;
}
img {
width:500px;
height:300px;}
</style>
</head>
<body>
<div id="main">
<img id="imgCar" src="images/Bugatti.jpg" title="">
<br>
<input type="button" value="Bugatti" onClick="changeImage(this.value, 'Bugatti 1001', '2010', 'xe cu',250);">
<input type="button" value="Chrysler" onClick="changeImage(this.value, 'Bugatti 1001', '2010', 'xe cu',250);">
<input type="button" value="Dodge" onClick="changeImage(this.value, 'Bugatti 1001', '2010', 'xe cu',250);">
<input type="button" value="Ferrari" onClick="changeImage(this.value, 'Bugatti 1001', '2010', 'xe cu',250);">
<input type="button" value="Hyundai" onClick="changeImage(this.value, 'Bugatti 1001', '2010', 'xe cu',250);">
</div>
</body>
</html>