On Wednesday, July 10, 2019 at 6:19:00 AM UTC-7, Quang Lam wrote: > > but this one still cause the section id "thisone" execute when the page is > loaded. i want this one to hold off until the user right click and select > an option in the menu because the section id "thisone" needs the > information of the row on which the user right click. if this section id > "thisone execute before the user right click, some of the variables will be > empty >
"Execute" may be a poor term for a non-procedural language like HTML and CSS. Javascript, of course, is procedural, and "execute" is a natural term there. In any case, if a DIV is declared when the page is loaded (that is, <DIV id=x> is in the html file), it's contents and attributes are evaluated then. They can be changed. The onclick handler can change contents, just as it changes the visibility attribute. The other approach is to not have the DIV in the html file, and to use the onclick handler to insert the DIV into the DOM. The trick to that is to have the id of the element that the DIV is inserted into. Finally, you can use the LOAD() helper to replace an empty DIV with the content returned from a request to the server (that's different from copying from another element, as in propagating the cell contents from a grid entry). It's a wrapper for AJAX, and I believe it uses jQuery under the hood. And if you need more control, you can unwrap the jQuery and do it yourself. I'm not the javascript expert in the group, but I've done various bits of this. /dps "on my good days I might pass as a journeyman jscripter" > On Wed, Jul 10, 2019 at 3:38 AM Dave S <snide...@gmail.com <javascript:>> > wrote: > >> >> >> On Tuesday, July 9, 2019 at 7:08:48 PM UTC-7, Quang Lam wrote: >>> >>> i have multiple <div> in my html page and i dont want all of them to be >>> executed when the page is loaded. is there any way that we can delay it >>> until the user right click on the context menu. i dont want to use >>> selector.show or selector.hide. because i want those <div> to be executed >>> after the user right click >>> >> >> The way I do it is to use [style].visiblity = "hidden", and toggle it >> document.getElementById("thisone").style.visibility = visible; >> >> and do that by using an onclick handler. >> >> /dps >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/edd2271a-97ec-424d-a0a6-1edd4114e417%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/edd2271a-97ec-424d-a0a6-1edd4114e417%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/95801dd5-5dc5-4715-8875-608ad19d31d2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.