I just know there is a JavaScript API, which allows you to inject some JavaScript for whatever you need. I use it to play next song without clicks, just type the keymap in Pentadactyl.

Note

Since Grooveshark was shutdown on April 30, 2015, this is no longer working. (2015-07-20T13:51:48Z)

map gsn :js if((gs = gBrowser.tabs[0].linkedBrowser.contentWindow.wrappedJSObject.Grooveshark) != undefined) gs.next();<CR>

I always have Grooveshark at first (pinned) tab. You can write it with a while loop.

Actually, I had wanted to be able to play next song without being in Grooveshark tab. I had thought of using media keys, but there is no easy way to let browser to recognize the media keys and I wanted not just in browser but more of system-wide.

I came up an idea with WebSocket. A common WS server for receiving key event sent by WM and for Pentadactyl to query for new key events. But I never got to start it. Just an idea.