[OT] Need help from Javascript Gurus

This WebDNA talk-list message is from

2006


It keeps the original formatting.
numero = 67651
interpreted = N
texte = I have been searching for an answer to this for the past several days with no luck. I found what I believe is causing the problem. Unfortunately, I suck at Javascript, and cannot figure out how to solve the problem. Hopefully someone here has an idea. I have set up a page that loads several other instances of a WebDNA generated page using AJAX (Asynchronous Javascript and XML) . The page that is being loaded asynchronously (the external file) has its own javascript file which it needs to load. The ajax script that I have allows for you to specify external javascript and css files to be loaded into the external file. But, it does not work because (as I understand it), the javascript file I am attempting to load runs on window.load. This apparently does not work with ajax included files, nor does attempting to run the script on the external page directly. I cannot even get a simple document.write statement to run when it is encoded directly onto the external page. The solution specified is to run the portion of the external .js file that normally runs on window.load, after the ajax routine. Unfortunately, that is where my eyes glazed over. Here is what I think are the relevant portions of the code: From the parent page: The 'ajaxpage' function runs the routine that loads the external page, while the loadobjs statement is supposed to load the external javascript file. And, it appears to do that (when loadobjs runs, the sorttable.js file appears in Safari's Activity Window). From the sorttable.js file: addEvent(window, "load", sortables_init); This function is what I have found needs to be run after the ajax command is run, but which apparently is not. Here is the code for the addEvent function: function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } else { alert("Handler could not be removed"); } } In addition to these code snippets, I have two links available, in case anyone cares to look at them. The first link contains the actual working javascript that is not being pulled through ajax. That link is: http://www.thecuriocloset.com/temp/products.tmpl?category=1027&head=T When the javascript is loaded on this page, the table headers are tuned into links, and clicking on them sorts the table. The second link is the same page, but loaded through the ajax routine: http://www.thecuriocloset.com/temp/productlist.tmpl This one should work the same, but does not. If anyone has any clue as to what the problem is here, or any suggestions, it would be greatly appreciated. I have been pulling out my hair for days now. Thanks, Dennis ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. [OT] Need help from Javascript Gurus ( "Dennis J. Bonsall, Jr." 2006)
I have been searching for an answer to this for the past several days with no luck. I found what I believe is causing the problem. Unfortunately, I suck at Javascript, and cannot figure out how to solve the problem. Hopefully someone here has an idea. I have set up a page that loads several other instances of a WebDNA generated page using AJAX (Asynchronous Javascript and XML) . The page that is being loaded asynchronously (the external file) has its own javascript file which it needs to load. The ajax script that I have allows for you to specify external javascript and css files to be loaded into the external file. But, it does not work because (as I understand it), the javascript file I am attempting to load runs on window.load. This apparently does not work with ajax included files, nor does attempting to run the script on the external page directly. I cannot even get a simple document.write statement to run when it is encoded directly onto the external page. The solution specified is to run the portion of the external .js file that normally runs on window.load, after the ajax routine. Unfortunately, that is where my eyes glazed over. Here is what I think are the relevant portions of the code: From the parent page: The 'ajaxpage' function runs the routine that loads the external page, while the loadobjs statement is supposed to load the external javascript file. And, it appears to do that (when loadobjs runs, the sorttable.js file appears in Safari's Activity Window). From the sorttable.js file: addEvent(window, "load", sortables_init); This function is what I have found needs to be run after the ajax command is run, but which apparently is not. Here is the code for the addEvent function: function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener){ elm.addEventListener(evType, fn, useCapture); return true; } else if (elm.attachEvent){ var r = elm.attachEvent("on"+evType, fn); return r; } else { alert("Handler could not be removed"); } } In addition to these code snippets, I have two links available, in case anyone cares to look at them. The first link contains the actual working javascript that is not being pulled through ajax. That link is: http://www.thecuriocloset.com/temp/products.tmpl?category=1027&head=T When the javascript is loaded on this page, the table headers are tuned into links, and clicking on them sorts the table. The second link is the same page, but loaded through the ajax routine: http://www.thecuriocloset.com/temp/productlist.tmpl This one should work the same, but does not. If anyone has any clue as to what the problem is here, or any suggestions, it would be greatly appreciated. I have been pulling out my hair for days now. Thanks, Dennis ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ "Dennis J. Bonsall, Jr."

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCat shared memory? (1999) docs for WebCatalog2 (1997) Upgrading old WebCat Database Files (1997) [TaxableTotal] - not working with AOL and IE (1997) Need NT Assist. w/ Emailer (2000) New Command prefs ... (1997) Database Options (1997) [include ...] behavior (1997) Install Webcatalog under NT4.0 and Microsoft IIS 2.0 (1997) RE: WebCat name recognition (was MacFinder -- a new WebDNAweb site) (1998) Help! WebCat2 bug (Ben's input) (1997) Error:Too many nested [xxx] contexts (1997) Another bug to squash (WebCat2b13 Mac .acgi) (1997) WebCatalog as a ListServ (1998) Who is doing sign-ups-got it (1998) WCS Newbie question (1997) [OT] - Javascript: Adding fields dynamically (2003) searchable list archive (1997) multi-paragraph fields (1997) Math inside [showif] (1998)