Write javascript code in the Snippet ?

View: New views
2 Messages — Rating Filter:   Alert me  

Write javascript code in the Snippet ?

by Neil.Lv :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

  Is there a easy way to write javascript code (dynamic for caculating
flashvars )in the Snippet ?

  To write javascript code directly just like the raw js code and
merge it into the head tag .

Cheers,
  Neil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Write javascript code in the Snippet ?

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Sat, Nov 7, 2009 at 10:24 PM, Neil.Lv <anim510@...> wrote:

Hi all,

 Is there a easy way to write javascript code (dynamic for caculating
flashvars )in the Snippet ?

import net.liftweb._
import http._
import js._
import JsCmds._
import util._
import Helpers._

class MySnippet {
  def calcVars(in: NodeSeq): NodeSeq = <head>{
    Script(JsRaw(
    "var my_var = "+(System.currentTimeMillis.toString.encJs)+";"
    ))
  }</head>
}

 

 To write javascript code directly just like the raw js code and
merge it into the head tag .

Cheers,
 Neil




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---