I don't think the alerts will ever do what you want them to
do.
Remember this is a deference between the server and the
client. CFML is
processed on the server completely, then sent to the client.
JavaScript
is processed on the client after the request has been sent
from the server.
If you did work out the syntax to build the alerts you are
just going to
get this in the source code of the browser.
...
alert(...);
...
alert(...);
...
alert(...);
...
ect.
Then when the ColorInfo function is called in the browser,
all the
alerts are going to fire off one after the other.
What is it you are trying to accomplish and we maybe able to
help figure
this out.
GO_BIGRED wrote:
> Hello,
>
> I can't seem to figure out why the below code does not
work. I'm just trying
> to create an array from a cfquery. The code does not
give any errors. but the
> alerts are not working. If I view the source of the
browser page I can see the
> array has the right information in it from the db. Why
aren't the alerts
> popping up?
>
> Thanks.
> Shawn Cowman
>
> --QUERY SECTION--
> <cfquery name="ShirtColors" dataSource =
"#Application.DB#">
> Select Color_ID, Name_V, HEX_V, ImageName
> From Qry_Gildan2000_Display_Yes
> </cfquery>
>
>
> --JAVASCRIPT SECTION--
> <script type="text/javascript"
language="JavaScript">
>
> function ColorInfo(Color_ID, Name_V, HEX_V, ImageName) {
> this.Color_ID = Color_ID
> this.Name_V = Name_V
> this.HEX_V = HEX_V
> this.ImageName = ImageName
> }
>
> var G2000_C = new Array()
> G2000_C[0] = new ColorInfo("Color_ID", "Name_V",
"HEX_V", "ImageName")
> <cfoutput query="ShirtColors">
> G2000_C[#CurrentRow#] = new ColorInfo(#Color_ID#,
'#Name_V#', '#HEX_V#',
> '#ImageName#');
> alert (Finished Row '#CurrentRow#');
> </cfoutput>
>
> alert (G2000_C[1].Color_ID+" - "+G2000_C[1].Name_V+" -
"+G2000_C[1].HEX_V+" -
> "+G2000_C[1].ImageName);
> </script>
>