It is up to you to determine where reuse lies in your own code. But it's quite simple (and a good idea) to create a library of commonly used functions. Create a file like mylib.js, for example with things like ...
function saveUser(f) {
add this to your pages:
<script type="text/javascript" src="mylib.js"></script>
add your event code as follows:
<s:link view="/User.xhtml" onclick="return saveUser($('user'));">
Please note that the library code avoids any dependencies on the layout or naming of elements on pages that use it. You can also leave small comments that will remind your future what the purpose and assumptions of these library functions are.
source share