But now I have a new problem.
I'm trying to make some easier editing tools for my site -- so that I can
Now here's the problem.
This is the line of code that adds an event handler to the IFRAME. This event handler detects clicks -- anywhere: it allows me to register ONE event handler to not only detect all clicks in the IFRAME but also detect WHAT was clicked -- in the IFRAME.
document.getElementById("interactivePreview"). contentDocument.addEventListener("click",detectClicks,true);
(the space before "contentDocument" was added to facilitate non-glitchy text-wrapping and is not present in the code, so that's not the problem).
Now the issue is, if I wrap that line in an alert() and call it from the address bar, it works PERFECTLY. But it doesn't do ANYTHING at all when it's run from the script itself. It's not in a function, it's in the page containing the IFRAME and it is in the global scope.
detectClicks is my wonderful function to detect the clicks in the IFRAME. Its code is not important or relevant to the issue. The problem is, I just can't seem to find a way to get that event listener to work from the script, only from the address bar. As I intend for these editors to be used by the other staff member on my site (and any future ones that I let join the staff) it needs to be user-friendly. That means I gotta find a way to get this to work from the page.
Any help?
I am sorted in
Non-subscriber "Stamps":
Devious Comments
Try window.addEventListener('DomContentLoaded',function(){Your eventlistener},false)
Just a thought.
--
It's a simple question, Doctor: If the moon was made of ribs, would you eat it?! It's not rocket science; answer yes so we can move on.
The event listener didn't work, but that suggestion got me to try using the IFRAME's onLoad attribute, which did!
Thanks
--
"I can levitate birds. No one cares."
~ Steven Wright (When The Leaves Blow Away)
Creative Worlds Forums
--
It's a simple question, Doctor: If the moon was made of ribs, would you eat it?! It's not rocket science; answer yes so we can move on.
Previous PageNext Page