|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Work with me on this please. (arrays and loops)
OK, I am trying to create a 100 by 100 area with images for each space..... they will start out as a plain square if no one has clicked on them yet, then as the user clicks on each, that image will change from a square to a squre with an x in it? Simple enough
![]() When they login I want it to be a new 'day' with a fresh start, so I set all the square as 'new' (square with no x)... This is how far i've gotten ![]() Then as they click each box, they turn to x's.. how can i go about doing this? I am new to cf and this is my first attempt at an array.. here is what i have so far.. please tell me if there is a better way to do this. Code:
<!--Creating 'Map' if one does not already exist--> <cfif NOT structkeyexists(session, "Map")> <cfset arrMap = arraynew(1)/> <cfloop index="Counter" From="1" To="100"> <cfset arrMap[#counter#] = "New"/> <cfif variables.arrMap[#counter#] EQ 'New'> <cfoutput> <a href="nextpage.cfm?area=#counter#"> <img src="/map/image1.gif"></a> <cfelse> <a href="nextpage.cfm?area=#counter#"> <img src="/map/image2.gif"></a> </cfoutput> </cfif> <cfif counter is '100'> <cfset session.Map = 'Created'> </cfif> </cfloop> </cfif> |
|
#2
|
|||
|
|||
|
Sorry, I'm not following what you are trying to do. You want to create an array of 100 elements, where each one of those elements has 100 elements (kind of like an Excel spreadsheet with 100 rows and 100 columns)? That's a two-dimensional array, that you'd create with "<cfset myArray = arrayNew(2) />".
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Hi can you give me a little bit more help/example?
I attached a pic of what I mean. I just want it to show 100 by 100 squares that user can click on.. then once they click on it, i want that square to have an x on it. ![]() Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Work with me on this please. (arrays and loops) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|