<input id="num" name=""> <input name="" type="button" value="go" onclick="num.value=a()" > <script> function fn(a) { a = parseInt(a, 36); return function() { return (a++).toString(36) } }; var a = fn('7xdfcx'); </script>