-
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>
-
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
Forum Rules
|
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
|
Bookmarks