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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: Simple but i am still too new

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple but i am still too new

    Hi I am bit of a script kiddy can use java and fiddle my way around but not to far.... i am busy coding our new company site and am using the following function to display random images in the banner section of the site. i run the code 4 times to get it the site to display 4 images at the top in the "banners section" like this

    <div id="banner_right">
    <script type="text/javascript" language="JavaScript"><!--
    printImage();//--></script>
    <script type="text/javascript" language="JavaScript"><!--
    printImage();//--></script>
    <script type="text/javascript" language="JavaScript"><!--
    printImage();//--></script>
    <script type="text/javascript" language="JavaScript"><!--
    printImage();//--></script>
    </div>

    I am battling to upgrade the script so i can run it once to display 4 side by side images and each one must be unique ..... i just not coming right here as it is beyond my current level. the java code i am using is

    NumberOfImagesToRotate = 26;

    FirstPart = '<a href="/products/products.html"><img src="/banners/img';
    LastPart = '.jpg" height="200" width="200"></a>';

    function printImage() {
    var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
    document.write(FirstPart + r + LastPart);
    }

    any pointers or help would be awesome !


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Simple but i am still too new

    java != javascript
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Simple Shopping Cart..... not so simple
    By jpsider in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 20th, 2012, 02:18 PM
  2. Simple I/O Question...well could be simple for you?
    By basketball8533 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: September 30th, 2011, 06:44 AM
  3. urgent simple help for a very simple program
    By albukhari87 in forum Java Applets
    Replies: 4
    Last Post: June 5th, 2010, 03:43 PM
  4. not so simple, simple swing question box
    By wolfgar in forum AWT / Java Swing
    Replies: 2
    Last Post: November 20th, 2009, 03:47 AM