asp.net mvc - Insert random text in textbox cshtml javascript MVC3 -


hi trying make mvc application random text can entered in text box. have made simple script random word array

<script type="text/javascript"> function random() {     var adjective = new array('quick', 'pleasant', 'successive', 'interim',     'optimistic', 'sensitive', 'temporary', 'reminiscent', 'drooly', 'muddy',     'maddening', 'ceaseless', 'bawdy', 'earthy', 'european', 'aboard',      'innovative', 'broad', 'smelly', 'mad', 'reduced', 'plucky', 'glib', 'liable',     'ratty', 'venomous', 'chivalrous', 'wide', 'moral', 'scary');     rdm = math.floor(math.random() * adjective.length);     document.getelementbyid("adj1").nodevalue = adjective[rdm]; } 

and have like

`

<div class="editor-label">     @html.labelfor(model => model.adj1)     <button type="button" title="random" id="1" onclick="random()">         <img src="../../content/themes/base/images/random.png" alt="" />     </button> </div> <div class="editor-field">     @html.editorfor(model => model.adj1)      @html.validationmessagefor(model => model.adj1)  </div>` 

its seems code never reaches random function, not sure doing wrong here.

try this:

document.getelementbyid("adj1").value = adjective[rdm]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -