⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js_image_maps.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JavaScript Image Maps</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

<h1>JavaScript Image Maps</h1><a href="js_animation.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="js_timing.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">An image-map is an image with clickable regions.</p>
<hr />

<h2>Examples</h2>
<p><a target="_blank" href="tryit.asp@filename=tryjs_imagemap_simple">Simple HTML Image map</a></p>
<p><a target="_blank" href="tryit.asp@filename=tryjs_imagemap">Image map with added JavaScript</a></p>
<hr />

<h2>HTML Image Maps</h2>
<p>From our HTML tutorial we have learned that an image-map is an image with clickable regions. Normally, each region has an 
associated hyperlink. Clicking on one of the regions takes you to the associated link.</p>

<h3>Example</h3>
<p>The example below demonstrates how to create an HTML image map, with clickable 
regions. Each of the regions is a hyperlink:</p>

<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
  <tr>
    <td valign="top">
	<pre>&lt;img src =&quot;planets.gif&quot;
width =&quot;145&quot; height =&quot;126&quot;
alt=&quot;Planets&quot;
usemap =&quot;#planetmap&quot; /&gt;</pre>
	<pre>&lt;map id =&quot;planetmap&quot;
name=&quot;planetmap&quot;&gt;
&lt;area shape =&quot;rect&quot; coords =&quot;0,0,82,126&quot;
  href =&quot;sun.htm&quot; target =&quot;_blank&quot;
  alt=&quot;Sun&quot; /&gt;
&lt;area shape =&quot;circle&quot; coords =&quot;90,58,3&quot;
  href =&quot;mercur.htm&quot; target =&quot;_blank&quot;
  alt=&quot;Mercury&quot; /&gt;
&lt;area shape =&quot;circle&quot; coords =&quot;124,58,8&quot;
  href =&quot;venus.htm&quot; target =&quot;_blank&quot;
  alt=&quot;Venus&quot; /&gt;
&lt;/map&gt; </pre>
    </td>
  </tr>
</table>

<h3>Result</h3>

<img src="planets.gif" width="145" height="126" usemap="#planetmap" alt="Planets" />
<map id="planetmap" name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" target="_blank" alt="Sun"></area>
<area shape="circle" coords="90,58,3" href="mercur.htm" target="_blank" alt="Mercury"></area>
<area shape="circle" coords="124,58,8" href="venus.htm" target="_blank" alt="Venus"></area>
</map>
<hr />

<h2>Adding some JavaScript</h2>
<p>We can add events (that can call a JavaScript) to the &lt;area&gt; tags inside the 
image map. The &lt;area&gt; tag supports the onClick, onDblClick, onMouseDown, 
onMouseUp, onMouseOver, onMouseMove, onMouseOut, onKeyPress, onKeyDown, onKeyUp, 
onFocus, and onBlur events.</p>
<p>Here's the above example, with some JavaScript added:</p>

<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3" id="table14">
  <tr>
    <td valign="top">
	<pre>&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function writeText(txt)
{
document.getElementById(&quot;desc&quot;).innerHTML=txt;
}
&lt;/script&gt;
&lt;/head&gt;</pre>
	<pre>&lt;body&gt;
&lt;img src=&quot;planets.gif&quot; width=&quot;145&quot; height=&quot;126&quot;
alt=&quot;Planets&quot; usemap=&quot;#planetmap&quot; /&gt;

&lt;map id =&quot;planetmap&quot; name=&quot;planetmap&quot;&gt;
&lt;area shape =&quot;rect&quot; coords =&quot;0,0,82,126&quot;
onMouseOver=&quot;writeText('The Sun and the gas giant
planets like Jupiter are by far the largest objects
in our Solar System.')&quot;
href =&quot;sun.htm&quot; target =&quot;_blank&quot; alt=&quot;Sun&quot; /&gt;

&lt;area shape =&quot;circle&quot; coords =&quot;90,58,3&quot;
onMouseOver=&quot;writeText('The planet Mercury is very
difficult to study from the Earth because it is
always so close to the Sun.')&quot;
href =&quot;mercur.htm&quot; target =&quot;_blank&quot; alt=&quot;Mercury&quot; /&gt;

&lt;area shape =&quot;circle&quot; coords =&quot;124,58,8&quot;
onMouseOver=&quot;writeText('Until the 1960s, Venus was
often considered a twin sister to the Earth because
Venus is the nearest planet to us, and because the
two planets seem to share many characteristics.')&quot;
href =&quot;venus.htm&quot; target =&quot;_blank&quot; alt=&quot;Venus&quot; /&gt;
&lt;/map&gt; 

&lt;p id=&quot;desc&quot;&gt;&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
    </td>
  </tr>
</table>
<br />
<hr />
<a href="js_animation.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="js_timing.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -