今天碰到了一个对我来说比较难的JavaScript练习题,做了一天都没有做出来,oh No!大家帮帮忙吧,谢谢你。
问题1:coords里面的四个数代表什么,我以为是调焦点位置的,还按照css里翻译成(left,top,width,height)来调位置。
问题2:href ="jdgjj.htm" target ="_blank" alt="Sun",这句代码是什么意思,里面的内容可以随意改吗?
感谢各位!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
function writeText(txt){
document.getElementById("desc").innerHTML=txt;
}
</script>
</head>
<body>
<img src="img/2.webp" width ="400" height ="550" usemap="#map" />
<map name="map">
<area shape ="rect" coords ="0,0,400,70"
onmouseover="writeText('间谍过家家全家福!')"
href ="jdgjj.htm" target ="_blank" alt="Sun" />
<area shape ="rect" coords ="0,60,140,40"
onmouseover="writeText('间谍过家家全家福!')"
href ="jdgjj1.htm" target ="_blank" alt="Sun" />
<area shape ="rect" coords ="0,60,130,50"
onmouseover="writeText('间谍过家家全家福!')"
href ="jdgjj2.htm" target ="_blank" alt="Sun" />
<area shape ="rect" coords ="49,100,72,260"
onmouseover="writeText('这个女人我也不认识')"
href ="gril.htm" target ="_blank" alt="Mercury" />
<area shape ="rect" coords ="140,70,125,220"
onmouseover="writeText('这位是黄昏先生哦!')"
href ="hh.htm" target ="_blank" alt="Venus" />
<area shape ="rect" coords ="265,110,85,205"
onmouseover="writeText('这位是漂亮的约尔小姐!')"
href ="yueer.htm" target ="_blank" alt="Venus" />
<area shape ="rect" coords ="120,290,110,250"
onmouseover="writeText('这个是小白!!!')"
href ="white.htm" target ="_blank" alt="Venus" />
<area shape ="rect" coords ="30,370,90,170"
onmouseover="writeText('这个是小白!!!')"
href ="white1.htm" target ="_blank" alt="Venus" />
<area shape ="rect" coords ="230,320,90,220"
onmouseover="writeText('这个是最最最可爱的安妮亚!!!')"
href ="anniya.htm" target ="_blank" alt="Venus" />
<area shape ="rect" coords ="340,430,60,80"
onmouseover="writeText('呀!我是情报员!')"
href ="qby.htm" target ="_blank" alt="Venus" />
</map>
<p id="desc">点击全家福来认识安妮亚吧!</p>
</body>
</html>