Some issues: 1) Move scaleHeader() into <initialization>...</initialization>. initCustomHead() is redundant. 2) Same for dojo.event.connect(....); 3) What is the value of ${completer}? Where is it specified?
br Igor On 9/4/07, Ken nashua <[EMAIL PROTECTED]> wrote: > > Folks, > > I am trying to operate some JavaScript within a component T-4.1.2 > > It is not coming out in the rendering of the markup. > > Is there any magic to this...? Some flag that needs to be set? My > component > is rendering fine. > > Code follows: > > thanks > Best regards > Ken in nashua > > Customhead.script > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE script PUBLIC > "-//Apache Software Foundation//Tapestry Script Specification 4.0 > //EN" > "http://jakarta.apache.org/tapestry/dtd/Script_4_0.dtd"> > > <script> > <include-script > resource-path="/org/trails/demo/components/CustomHead.js"/> > > <!-- E-Frastructure --> > <input-symbol key="id" class="java.lang.String" required="yes"/> > <input-symbol key="props" required="yes" /> > <input-symbol key="form" required="yes" /> > <input-symbol key="widget" required="yes" /> > > <!-- Business Logic --> > <input-symbol key="scaleWidth" required="yes" /> > <input-symbol key="scaleHeight" required="yes" /> > <input-symbol key="imageWidget" required="yes" /> > > <let key="CustomHead" unique="yes"> > ${id} > </let> > > > <!-- then use: var box = dojo.html.getContentBox(HTMLElement) --> > <!-- use the box values box.width and box.height to perform an ajax > call > through --> > <!-- a tapestry service (better to do on page finish load so that > you'll > perform --> > <!-- a single call, and do it in json). When you receive the > message back, > then --> > <!-- you can set the background image for every image you want. --> > <!-- ...or you can call after the ajax response --> > <!-- dojo.html.insertCssText(cssStr, doc) --> > > > <body> > <unique> > dojo.require("tapestry.widget.Widget"); > dojo.require("dojo.widget.Manager"); > dojo.require("dojo.widget.HtmlWidget"); > dojo.require("dojo.widget.*"); > dojo.require("dojo.html"); > dojo.require("dojo.event.*"); > dojo.require("dojo.uri.Uri"); > dojo.require("dojo.dom"); > dojo.require("dojo.style"); > > dojo.event.connect(tapestry, "loadJson", > function(type, data, http, > kwArgs){ > // do your stuff...the data argument is > your json object > }); > </unique> > initCustomHead(); > </body> > > <initialization> > var ${completer}=${props}; > var selw=dojo.widget.byId("${id}"); > tapestry.widget.synchronizeWidgetState("${id}", > "CustomHead", ${props}, > ${widget.destroy}); > </initialization> > </script> > > CustomHead.js > /** > * JavaScript Custom Head control > * > * @author kenneth.colassi [EMAIL PROTECTED] > * > * Aug 2007 > **/ > > // Initialize the Custom Head > function initCustomHead() { > window.onload = scaleHeader(); > } > > function scaleHeader() { > debugger; > var elementId = 'header'; > var headerElement = document.getElementById(elementId); > > var cb = dojo.html.getContentBox(headerElement); > var cb = dojo.html.getPaddingBox(headerElement); > var bb = dojo.html.getBorderBox(headerElement); > var mb = dojo.html.getMarginBox(headerElement); > } > > Customhead.jwc > <!DOCTYPE component-specification PUBLIC "-//Apache Software > Foundation//Tapestry Specification 4.1//EN" > "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd"> > <component-specification class="org.trails.demo.components.CustomHead" > allow-body="yes" > > > allow-informal-parameters="no"> > > <inject property="applicationSpecification" > object="infrastructure:applicationSpecification"/> > <inject property="script" type="script" object="CustomHead.script > "/> > > </component-specification> > > _________________________________________________________________ > Discover sweet stuff waiting for you at the Messenger Cafe. Claim your > treat today! > > http://www.cafemessenger.com/info/info_sweetstuff.html?ocid=TXT_TAGHM_SeptHMtagline2 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >