![]() |
JavaScript Insertion Place - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: JavaScript Insertion Place (/thread-996.html) |
JavaScript Insertion Place - ShaneStump - 03-15-2019 Howdy All! I have a region that is visible for the user to add some notes. If the user clicks outside the region, I want to close it. I have found the following code example: https://jsfiddle.net/kym2rvyL/1/ I have tried adding a modified version of the function below to my form's Javascript property but it doesn't get called. window.addEventListener('click', function(e){ if (document.getElementById('clickbox').contains(e.target)){ alert("Clicked in Box"); } else{ alert("Clicked outside Box"); } }) Any idea what I am doing WRONG? Thanks, Shane RE: JavaScript Insertion Place - kudzu - 03-15-2019 Your code may be running after the element you want is being loaded into the DOM. Can you make a simple ready to run SA dpr? RE: JavaScript Insertion Place - ShaneStump - 03-20-2019 Howdy Big K! Sorry for the delay getting back - I have been all over the place with getting my new web module done. I have found some excellent jquery components I have wrapped and then others that are to much work. I really prefer app development for mobile devices and Windows to messing with web browsers! Any how, I got the aforementioned routine to work and even added a property in some of my components to create a global javascript variable so I could check them if necessary (i.e. the drop-down calendar I am using apparently doesn't show up a child of the region I was checking to see if I needed to close it)! Well, enough rambling-on ..... I need to get cameras and motorcycle ready to head out to Big Bend tomorrow. Have a great week! Shane RE: JavaScript Insertion Place - kudzu - 03-20-2019 Check this out.... We hope you will be as amazed as we are. https://doc.atozed.com/en/iw17/lang/delphi/tutorial/page-properties/ RE: JavaScript Insertion Place - ShaneStump - 03-22-2019 (03-20-2019, 10:12 PM)kudzu Wrote: Check this out.... We hope you will be as amazed as we are. Howdy K from Fort Davis Tejas! That new feature looks great! It would be great to have variables in Delphi/C Builder that are binded and available to Javascript! Looking forward to IW 17 if I ever get my new web module done ![]() All the best, Shane |