在網頁中如果圖片有連結,滑鼠移到圖片上方會自動將游標變成手指圖示,但是如果您是要在圖片上寫javascript來控制form表單的送出,就不能用圖片連結,這時候就必需使用css來達到這個效果。
底下是用圖片有連結的語法
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<a href="http://learnwebdesignonline.com"><img src="banner88_31.gif" width="88" height="31" border="0" /></a>
</body>
</html>
底下是利用css來達到手指的圖示
<!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=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
img.clickimage {
cursor: pointer;
}
</style>
</head>
<body>
<img src="banner88_31.gif" width="88" height="31" onclick="javascript:window.location = 'http://learnwebdesignonline.com';" class="clickimage"/>
</body>
</html>
參考網站:
Using Cursor Hand or Cursor Pointer?