how to get a random user input variable to return in html

wolf2008

New Member
Ok so basically what i'm trying to do is create an html document that allows the user to input any thing they want with any number of choices and click a button and get one of the things they typed in to be chosen at random. My girlfriend is really indecisive and sometimes takes hours to make a choice when i'm not around so i thought i'd write her a code to help. I'm not exactly sure how to go about this. I have searched around for a few hours and have found nothing about this. Sorry if it's something extremely simple but any help would be greatly appreciated. So far i have this as a code to get a text box and make a new one appear by clicking the button ` \[code\]<html><head> <script type="text/javascript">var instance = 1; function newTextBox(element){ instance++; var newInput = document.createElement("INPUT");newInput.id = "text" + instance;newInput.name = "text" + instance;newInput.type = "text";//document.body.write("<br>");document.body.insertBefore(newInput, element);document.body.insertBefore(document.createElement("br"), element); }</script></head><body><input id="text2" type="text" name="text1"/> <br><input type="button" id="btnAdd" value="http://stackoverflow.com/questions/15776731/New text box" onclick="newTextBox(this);" /></body></html>`\[/code\]
 
Top