[Javascript] Passive, Javascript-callable, in-line (PHP) codereferences withina

David T. Lovering dlovering at gazos.com
Tue Apr 8 11:55:25 CDT 2003


Michael's suggestion gets about half-way to where I need to be...  merely manipulating the
style properties of objects inside a span is useful, but a far cry from remote execution.

Michael Dougherty wrote:
> 
> <span id='hiddenStuff' style='display: none;'>
>   <!--this HTML will render inside an undisplayed container -->
>   <input type='text' name='pseudo-hidden-field1' value='' />
> </span>
> <input type='button' value='Toggle'
> onClick='(hiddenStuff.style.display=="none") ? "inline" : "none"; ' />

What would be really neat is if this could be generalized as follows:

  <span id='hiddenStuff' style='display: none'>
  <!-- this HTML will render inside an undisplayed container -->
  <?php
    function somethingReallyComplex(var1, var2, var3, ...) {
      lots of abstruse PHP code...
      return returnValue;
    }
  ?>
  </span>

  and elsewhere in the more visible code...

  <input type='button' value='launch somethingReallyComplex'
         onClick='[mysterious stuff] somethingReallyComplex(val1, val2, val3, ...) [more mysterious stuff]'>

  If all the parameters, objects, etc. which are needed by the PHP code are already defined and accessible, the client should (in theory) be able to invoke the PHP code out-of-band.  There are ways of doing this presently by launching a remote and popping
the PHP code into it, but that is sort of awkward.  (Also the window manager gets
grumpy if you have orphan windows laying about after a premature manual exit).  I'd like to replace the remote with the same or similar code inside an embedded in-line structure of some sort.  Who cares if it is actually executing on the server -- what
matters is that the PHP code is invoked by user-generated events, and makes reference to client-side window elements and data.

  Yours in perplexity,

  Dave Lovering


More information about the Javascript mailing list