Hi steve ,
Hmm… Making headway , showing iframe elements
But I’m still not collecting allTags .
Node list is still showing 0 , don’t know why .
Code:
const load = () => {
//var iframe1 = document.querySelector(“iframe1”).contentWindow.document;
var iframe1 = document.getElementById('iframe1')
console.log("iframe1");
console.log(iframe1);
var allTags= iframe1.querySelectorAll("a");
console.log("allTags");
console.log(allTags);
function WhichLinkWasClicked(evt) {
alert( evt.target ) ;
evt.preventDefault();
}
console.log("for(let i of allTags){1}")
for(let i of allTags){
i.addEventListener('click', WhichLinkWasClicked)
console.log("for(let i of allTags){2}")
console.log(i.allTags) ; }
}
document.addEventListener('DOMContentLoaded', load);
Console:
WIP-Parent-ThisShouldWork-Steve.html:
26 iframe1
WIP-Parent-ThisShouldWork-Steve.html:
27
<iframe id="iframe1" src="SomeLocalLinks-01.html" name="iFrame1">
#document
<!DOCTYPE html>
<html lang="en">
<head>…
</head>
<body>
<h1 style="text-align:
center">01 Same-Domain , Same Folder
</h1>
<br>
<br>
<a href="SomeLocalLinks-01.html">SomeLocalLinks-01
</a>
<br>
<br>
<a href="SomeLocalLinks-02.html">SomeLocalLinks-02
</a>
<br>
<br>
<a href="SomeLocalLinks-03.html">SomeLocalLinks-03
</a>
<br>
<br>
<a href="SomeLocalLinks-04.html">SomeLocalLinks-04
</a>
<br>
<br>
</body>
</html>
</iframe>
WIP-Parent-ThisShouldWork-Steve.html:
29 allTags
WIP-Parent-ThisShouldWork-Steve.html:
30
NodeList []length:
0__proto__:
NodeListentries:
ƒ entries()forEach:
ƒ forEach()item:
ƒ item()keys:
ƒ keys()length:
(...)values:
ƒ values()constructor:
ƒ NodeList()Symbol(Symbol.iterator):
ƒ values()Symbol(Symbol.toStringTag):
"NodeList"get length:
ƒ length()__proto__:
Object
WIP-Parent-ThisShouldWork-Steve.html:
36 for(let i of allTags){1}
Thanks