[jbosstools-dev] Embedded javascript in the VPE visual document?

Marshall Culpepper mculpepper at appcelerator.org
Fri Aug 15 15:24:54 EDT 2008


Hey guys..

I was curious if it's possible to execute javascript by adding <script>
nodes into the head node the same way that <link> nodes are added for CSS
styles. I've created a method that does it for me locally, but the script in
question doesn't seem to be executing... is there something special needed
to make javascript work in this document? Here's my snippet:

public static void addScriptNodeToHead (VpePageContext pageContext,
nsIDOMDocument visualDocument, String scriptSrc) {
        nsIDOMNode headNode =  pageContext.getVisualBuilder().getHeadNode();

        nsIDOMElement scriptNode = visualDocument.createElement("script");
        scriptNode.setAttribute("src", scriptSrc);
        scriptNode.setAttribute("type", "text/javascript");

        headNode.appendChild(scriptNode);
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20080815/88234905/attachment.html 


More information about the jbosstools-dev mailing list