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

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -