<form id="my_form"></form> <script> my_form.nvalue=function() { alert( this.id+" works"); } my_form.nvalue(); </script>