DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links