Button to run Javascript

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

Button to run Javascript

by AnthonyW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I needed a button that "goes back", so I created an ajaxButton with
code like:

    SHtml.ajaxButton("Cancel", () => JsCmds.jsExpToJsCmd(JsRaw
("history.back();")))

So, is this the "best" version?  Or can this be simplified?

(I didn't feel well acquainted to leveraging Javascript from reading
the Exploring Lift book.  Maybe there needs to be a few more
examples?)

--~--~---------~--~----~------------~-------~--~----~
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: Button to run Javascript

by bearfeeder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Tue, Nov 3, 2009 at 1:35 AM, aw <anthony@...> wrote:

I needed a button that "goes back", so I created an ajaxButton with
code like:

   SHtml.ajaxButton("Cancel", () => JsCmds.jsExpToJsCmd(JsRaw
("history.back();")))

This is going to make a server round-trip.  I'd suggestion using simple HTML:

<button onclick="history.back(); false">Cancel</button>
 

So, is this the "best" version?  Or can this be simplified?

(I didn't feel well acquainted to leveraging Javascript from reading
the Exploring Lift book.  Maybe there needs to be a few more
examples?)





--
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
-~----------~----~----~----~------~----~------~--~---