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