Javascript Shortcode Area
-----Version 110606-----
 test2 

<html>
<head>
<title>document.links[index]</title>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<link rel="stylesheet" href="../css_main.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<h4 align="center">document.links[index番号]</h4>
<p>「<a id="jump" href="../aaa/start.htm">ごあいさつ</a>」ページへジャンプ・・・・・
<button onclick=alert(document.links[0].href);>現在のリンク先urlは</button></p>
<button onclick="document.links[0].href='../aaa/books.htm';jump.innerText='参考書籍'">上のリンクを「参考書籍」ページに変更</button><br>
<button onclick="document.links[0].href='http://www.yahoo.co.jp/';jump.innerText='Yahoo!'">上のリンクを「Yahoo!」ページに変更</button><br>
<button onclick="document.links[0].href='http://www.google.com/';jump.innerText='Google'">上のリンクを「Google」ページに変更</button>
<hr>
<ul>
<li><font color="#FF0000">linksプロパティ</font>には、現在ページのリンク情報が配列として保持されている。そしてページ内の各リンクは、先頭から順番に0〜から始まるIndex番号が付けられる。</li>
<li><font color="#FF00FF">document.links[index番号].href</font> で現在ページ内のindex番号位置のリンク先urlを取得できる。</li>
<li><font color="#FF00FF">document.links[index番号].href=url;</font> で現在ページ内のindex番号位置のリンク先を指定urlに変更できる。<br>
</li>
</ul>
</body>
</html>


使用変数

align
bgcolor
charset
color
content
equiv
href
id
innerText
onclick
rel
text
type