<form name="randform"> <input type="button" value="Create Random String" onClick="randomString();"> <input type="text" name="randomfield" value=""> </form>