<BTW>
Wez Furlong has written an ActiveScript compatible plugin that
allows running php clientside in the browser - YMWV.
</BTW>

Robert Cummings wrote:
On Wed, 2006-04-26 at 16:47, Evan Priestley wrote:


...

nice func Rob. :-) now onward to HELL ...

?>

Unfortunately, you're going to have a HELL of a time with dynamically
include()'ing source :)

function includeJS(jsPath)
{
    // bogus URL/path to script?
    if (!isString(jsPath) || !jsPath) {
        return;
    }

    // remove extraneous spaces - just in case
    jsPath = jsPath.trim();

    // has the given script already been 'included'?
    var scripts = document.getElementsByTagName("SCRIPT");
    var scriptsLen = scripts.length;
    for (var i = 0; i < scriptsLen; i++) {
        if (scripts.src == jsPath) {
            // the requested file has already been added (or was defined/linked 
from the start.
            return;
        }
    }

    // everything is ok, lets include the script.
    var script = document.createElement("SCRIPT");

    script.setAttribute("type", "text/javascript");
    script.setAttribute("src", jsPath);

    document.getElementsByTagName("HEAD")[0].appendChild( script );
}

probably far from perfect but it's helped me out of a jam now and again.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to