Help with a JS button to open a page based on row id

I’m still pretty new to Javascript. I need a button or link that will open an edit page based on the id of the selected row (or show an alert msg if no row is selected). I have a link column in the grid I’m working on now so I can’t use in-line editing.

I’m using Rails so all I need is a static link like ‘…/edit/’ with the id number after the slash (like “…/edit/1”). I’ve been playing around with Form buttons and JS new window functions tonight but I haven’t been able to figure out how to add the id of the selected row onto the end of the hyperlink.

Thanks!

There are a lot of different way to achieve such result, one of simple one - events

grid.attachEvent("onRowSelect", function(id){ document.location.href = "/some/some/"+id; return true; })