首页 > 代码库 > JS的document.links函数使用示例

JS的document.links函数使用示例

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>JS的document.links函数使用示例</title>
    </head>
    <body>
        <img src="planets.gif" width="145" height="126" usemap="#planetmap" />

        <map name="planetmap">
            <area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm" />
        </map>
        
        Number of links in this document:
        <script type="text/javascript">
            document.write(document.links.length);
            document.write(document.links[0].id);
        </script>
    </body>
</html>

JS的document.links函数使用示例