Hi!



I'm not sure if I used your proposal correctly, nevertheless "best" result 
was following (which leads me again to wrong workflow idea of non existing 
body element):

Uncaught TypeError: Cannot call method 'observe' of undefined





What is working for me is jQuery with 10 years old javaScript:




jQuery(document).ready(function() { 

 document.body.setAttribute("onload","setPosition();");

document.body.setAttribute("onScroll","setPosition();");

});





So, problem solved. Thanks for all answers!

Best regards

Ladislav


---------- Původní zpráva ----------
Od: Thiago H de Paula Figueiredo <thiag...@gmail.com>
Komu: Tapestry users <users@tapestry.apache.org>
Datum: 20. 2. 2014 0:05:09
Předmět: Re: Executing JS function from component ONCE

"On Wed, 19 Feb 2014 18:48:02 -0300, <la...@email.cz> wrote:

> Hi!

Hi!

> var db = function decorateBody() {
> document.body.setAttribute("onload","setPosition();");
> document.body.setAttribute("onScroll","setPosition();");
> }

You're using JavaScript that looks like 10 years ago. Use event listeners 
for that. If you're using Prototype, it would be something like 
$$('body')[0].observe('load', setPosition); 
$$('body')[0].observe('scroll', setPosition); (this wasn't tested).

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org"

Reply via email to