[Javascript] Passive, Javascript-callable, in-line (PHP) code references withinan HTML document

David T. Lovering dlovering at gazos.com
Tue Apr 8 11:13:22 CDT 2003


While continuing to research the multiframe/multiform issues with respect to the 'onLoad' event, I came across another conundrum.

How does one reference in-line code modules within a given HTML document, particularly if they are to be invoked by a Javascript call?  The reverse is simple (simply embed a <script> ... </script> block), so I had hopes that this would be also.  Yes, yes
-- I know:  I'm mixing client-side code with server-side code.  Dont' bug me -- it works (and works well), despite what the books would have you believe.  As long as you keep tabs on the sequence of invocation and who has the execution and/or access to
which variables, it isn't that tough.  However, I want to condense my rather large collection of executable php files into some kind of inline structure I can mesh passively with the regular HTML document, and still invoke the needed routines from
JavaScript whenever I like.

I've experimented with DIVs, IFRAMEs, anchors, and such like -- but all of these tend to have a screen presence, and distort the existing screen geometry.  The only way I've found (so far) that works is to deliberately build another window, hide it, pour
the PHP code (or whatever) into it, and then back-reference to the objects in the window.opener document.  This is ugly, and it tends to turn one's statusbar into a riot of activity.

Any clues?  I'm certain there is some bizarre combination of anchors, divs, <script> and such-like that will permit this to happen, but I've found no references to anyone else doing it.  It is one piece of magic I'd really like to have in my warchest.

-- Dave Lovering


More information about the Javascript mailing list