2024-04-12 10:42:15 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
First Name: <input name="fname" type="text" value="Michael"><br>
|
|
|
|
First Name: <input name="fname" type="text" value="Doug">
|
|
|
|
|
|
|
|
<p>Click the button to get the outer html of anchor number 1. Anchors are counted from 0.</p>
|
|
|
|
|
|
|
|
<button onclick="myFunction()">Try it</button>
|
|
|
|
|
|
|
|
<a href="/" name="aaa">/</a>
|
|
|
|
<a href="/home" name="bbb">/home</a>
|
|
|
|
|
|
|
|
<p id="demo"></p>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function myFunction() {
|
|
|
|
var x = document.anchors.item(1).outerHTML;
|
2024-05-08 09:57:56 -04:00
|
|
|
console.assert(x === '<a href="/home" name="bbb">/home</a>', 'anchors');
|
2024-04-12 10:42:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
console.error('document.anchors.html');
|
|
|
|
myFunction();
|
2024-06-01 07:30:03 -04:00
|
|
|
console.exit();
|
2024-04-12 10:42:15 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|