下面的代碼完美地工作,當用戶將鼠標懸停在圖像映射的熱點上時,可以完美地顯示圖像。唯一的問題?當點擊'this.href'當然會將用戶帶到熱點圖像本身。我想保留'href'將用戶發送到我選擇的頁面。用this替換this.html.title
是否可以使用「標題」而不是「href」來定義熱點圖像?如果是這樣,請顯示詳細信息,我很新的JavaScript,謝謝!
<script type="text/javascript">
function ShowPicC(sImage){document.housec.src = sImage}
</script>
<img border="0" src="main-image.png" width="640" height='640' usemap="#FPMap0">
<map name="FPMap0">
<area onmouseover='ShowPicC(this.href)' href='hotspot1.png' alt="thisalt" title="can-png-go-here.png" shape="circle" coords="400,400,20">
<area onmouseover="ShowPicC(this.href)" href="hotspot2.jpg" alt="youralt" title="can-png-go-here2.png" shape="circle" coords="420,420,20">
<area onmouseover="ShowPicC(this.href)" href="hotspot3.jpg" alt="differentalt" title="can-png-go-here3.png" shape="circle" coords="440,440,20">
<area onmouseover="ShowPicC(this.href)" href="hotspot4.jpg" alt="whateveralt" title="can-png-go-here4.png" shape="circle" coords="460,460,20">
</map>
<img name="housec" src="starter-hotspot-image.png" width="192" height="170">
哪裏是'title'在HTML? –
謝謝Tom Fenech,將標題添加到HTML中。 – ablase