Please help an novice


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Please help an novice

  1. #1
    Join Date
    May 2005
    Posts
    3

    Please help an novice

    Hello, I am trying to get the code below to display the contents of htmlcontent in order to check that my for loop is working. However i can't get it to display anything. Is this because my for loop is wrong or am i doing something else wrong. Thanks in advance for your help.

    Tom


    <HTML>

    <HEAD>
    </HEAD>


    <script language="JavaScript">

    function populate(){

    // Number of starbuy images

    var numberofimages=11


    //array setup for number of images

    sbimagetag = new Array[numberofimages]

    var htmlcontent=''
    var noimg=''
    var pauseit="1"

    for (noimg = 1; noimg<=numberofimages;noimg++){
    sbimagetag[noimg-1]='<a href="starbuys.html"><img src="style/images/starbuys/' + noimg + '.gif"></a><br>'
    htmlcontent+=sbimagetag[noimg-1]
    }


    document.getElementById("array").innerHTML = htmlcontent
    }


    </script>
    <BODY onload="populate">
    <div id="array"></div>

    </BODY>
    </HTML>

  2. #2
    Join Date
    Dec 2003
    Location
    tx/us
    Posts
    131
    That's Javascript, not Java. Put your page on a server and load it with Firefox with the Javascript console open.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center