• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Show different text when a button is pressed - In the same view

New Here ,
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

I am trying to make it so that any time the user presses a button in the application a different text appears in a textArea, like there are about 50 differeent phrases, and I want the app to choose a different one at random and display it in the textArea every time the button is pressed. anyone know how?

Views

389

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

LATEST

If i am getting this correct, its pretty straight forward as you can have all the phrases in the array collection (you can use xml) and then on mouse click event get the random index using Math.random() .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines