Well assume you snippet returns a NodeSeq:
import net.liftweb.http._
import js._
import JE._
import JsCmds._
def myFunc(xml: NodeSeq): NodeSeq = {
...
resultingNode ++ <head>{Script(OnLoad(Call("myStartupFunction")))}</
head>
}
In the above example we are returning a <head> node as well which will
be merged by Lift automatically in the real page <head>. Then I'm
using Lift's JavaScript abstractions to call on load function
myStartupFunction. Instead of
<head>{Script(OnLoad(Call("myStartupFunction")))}</head> you can also
use
<head>
<script type="text/javascript" charset="utf-8">{
Unparsed("""
jQuery(document).ready(function() {
myStartupFunction();
})
""")
}
</head>
Br's,
Marius
On Jul 30, 8:13 am, DFectuoso <[email protected]> wrote:
> This is probably trivial but can't seem to find the lifty way...
> without hand rolling javascript
> What is the best way to generate(in the snippet) a javascript command
> to be run on the window.onload event?
>
> Thank you very much you divine and infinite source or lift knowledge
> AKA lift google group =)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---