I'm trying to insert an onscroll event to an IFRAME in HTML code, in order to trigger an event when the user has scrolled the site/document all the way to the bottom.
I found several suggestions on "stackoverflow", and tried to use them but for some reason The code I inserted doesn't work.
this is one example to my code:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to change the value of the src attribute in the iframe.</p>
<input type= "url" id="hi" value = "hello" onchange="myFunction2()">
<button onclick="document.getElementById('myFrame').src = document.getElementById('hi').value;" id=getFile >Upload File</button></br></br>
<iframe id="myFrame" src="https://agilepoint.com/"></iframe>
<p id="demo"></p>
<script>
window.onscroll = function(ev) {
var Frame = document.getElementById("myFrame");
if ((Frame.innerHeight + Frame.scrollY) >= document.body.offsetHeight) {
alert("you're at the bottom of the page");
}
};
</script>
</body>
</html>
Also tried this:
<!DOCTYPE html>
<html>
<body>
<p>Click the button to change the value of the src attribute in the iframe.</p>
<input type= "url" id="hi" value = "hello" onchange="myFunction2()">
<button onclick="document.getElementById('myFrame').src = document.getElementById('hi').value;" id=getFile >Upload File</button></br></br>
<iframe id="myFrame" src="https://agilepoint.com/"></iframe>
<p id="demo"></p>
<script>
document.getElementById("myFrame").onscroll = function(ev) {
var Frame = document.getElementById("myFrame");
if ((Frame.innerHeight + Frame.scrollY) >= document.body.offsetHeight) {
alert("you're at the bottom of the page");
}
};
</script>
</body>
</html>
Didn't work. I'd appreciate the help. thanks!