Seven price
asked on
jquery for loop
I need to have certain amount images show up where i is in the file name.
var maxRows = this.NoOfPages; << here I have a total lets say max total is 6.
how can I add a for loop to add six images and using the [i] at the end of this.filename to appear. 1,2,3,4,5,6
$("#stack").append($("<img>",
{
stack: "true",
src: "http://ing.com/" + this.FilePath + '/' + this.FileName[i],
Style: "width: 600px; height: 750px; z-index: 0; margin-left:auto; margin-right:auto; border: 5px solid rgb(255, 255, 255); box-shadow: 0px 0px 5px rgb(85, 85, 85)"
}));
ASKER
Well you are somewhat correct, I want to append the count but if the count is 6 then I want to have 6 images.
The image names would be
filename1.jpg
filename2.jpg
filename3.jpg
filename4.jpg
The image names would be
filename1.jpg
filename2.jpg
filename3.jpg
filename4.jpg
but if the count is 6 then I want to have 6 imagesI understood that - just needed to know where you were expecting to append the count to filename or filename string - you answered that above.
Also need to know what you expect from this statemet
$("#stack").append($("<img>",
{
stack: "true",
src: "http://ing.com/" + this.FilePath + '/' + this.FileName[i],
Style: "width: 600px; height: 750px; z-index: 0; margin-left:auto; margin-right:auto; border: 5px solid rgb(255, 255, 255); box-shadow: 0px 0px 5px rgb(85, 85, 85)"
}));
It does not look valid - I have not seen .append() used in this way before - can you elaboarate on what you are expecting the result from this to be.
ASKER
$("#stack").append($("<img>",
{
stack: "true",
src: "http://ing.com/" + this.FilePath + '/' + this.FileName[i],
Style: "width: 600px; height: 750px; z-index: 0; margin-left:auto; margin-right:auto; border: 5px solid rgb(255, 255, 255); box-shadow: 0px 0px 5px rgb(85, 85, 85)"
}));
The statement above will be<img src="filename1" />
<img src="filename2" />
<img src="filename3" />
<img src="filename4" />
<img src="filename5" />
<img src="filename6" />
Still confused about this part
Always interested to learn more - so if you can point me to where you found this code or where there is a description of this use of .append - that would be a good first step.
$("#stack").append($("<img>",
{
stack: "true",
src: "http://ing.com/" + this.FilePath + '/' + this.FileName[i],
Style: "width: 600px; height: 750px; z-index: 0; margin-left:auto; margin-right:auto; border: 5px solid rgb(255, 255, 255); box-shadow: 0px 0px 5px rgb(85, 85, 85)"
}));
Do you have any references that documents the above usage of the .append() method. I have tried it in test code and it does not work.Always interested to learn more - so if you can point me to where you found this code or where there is a description of this use of .append - that would be a good first step.
ASKER
how about lets keep it simple. create an array in jquery
example
var max = 6
I need to have array 1 2 3 4 5 6 in a loop or for each.
you have example of this.
example
var max = 6
I need to have array 1 2 3 4 5 6 in a loop or for each.
you have example of this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your time and patience
You are welcome - thanks for the points.
What are you trying to do with the append I am not familiar with that syntax?
According to the docs you can submit multiple parameters to append but they should ultimately all end up as DOM objects.
When you say you want to append the i to the filename - do you mean like this
filename.jpg => filename1.jpg
Or like this
filename.jpg => filename.jpg1
Or are your filenames formatted differently - if so can you give some examples.