2021-05-12 11:08:05 -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">
|
|
|
|
|
2022-08-30 10:07:14 -04:00
|
|
|
<p>Click the button to get the outer html of anchor number 1. Anchors are counted from 0.</p>
|
2021-05-12 11:08:05 -04:00
|
|
|
|
|
|
|
<button onclick="myFunction()">Try it</button>
|
|
|
|
|
2023-04-04 10:47:17 -04:00
|
|
|
<a href="/" name="aaa">/</a>
|
|
|
|
<a href="/home" name="bbb">/home</a>
|
2021-05-12 11:08:05 -04:00
|
|
|
|
|
|
|
<p id="demo"></p>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function myFunction() {
|
|
|
|
var x = document.anchors.item(1).outerHTML;
|
2021-11-10 12:05:35 -05:00
|
|
|
window.alert(x);
|
2021-05-12 11:08:05 -04:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|