Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: this works, but I want to print this to the screen in a fixed position

  1. #1
    Junior Member
    Join Date
    May 2022
    Thanked 0 Times in 0 Posts

    Default this works, but I want to print this to the screen in a fixed position

    this works, but I want to print this to the screen in a fixed position on a HTML web page


    <form name="random"><input type="text" name="random" size=78 value=""></form>
    <SCRIPT LANGUAGE="JavaScript">

    function getMessage() {
    // create array
    var ar = new Array();

    ar[0] = "easy does it"
    ar[1] = "first things first"
    ar[2] = "live and let live"
    ar[3] = "but for the grace of God"
    ar[4] = "think ... think ... think ..."
    ar[5] = "one day at time"
    ar[6] = "this too shall pass"
    ar[7] = "if it works .... don't fix it"
    ar[8] = "keep coming back .... it works if you work it"
    ar[9] = "sobriety is a journey .... not a destination"

    // Chooses a random array number
    var i = Math.floor(Math.random() * ar.length);

    document.random.random.value= ar[i]


    Last edited by KingSparta; May 10th, 2022 at 02:55 AM.

Similar Threads

  1. [SOLVED] Adjust screen size and button arrangement for any computer screen
    By Prathiksha in forum AWT / Java Swing
    Replies: 4
    Last Post: April 23rd, 2014, 11:11 AM
  2. Replies: 9
    Last Post: September 15th, 2013, 02:48 PM
  3. Replies: 1
    Last Post: December 3rd, 2012, 02:35 PM
  4. Replies: 9
    Last Post: December 31st, 2011, 01:22 AM
  5. How to print results to screen
    By NinjaLink in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 19th, 2010, 01:46 PM