|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello all. I am a complete newbie both at cfm and javascript. I am more in the design area, but i am taking a shot at this and liking what i see and taking more interest.
Here is my bug... Tryng to do a query in cfm that will pull lets say... 18 hotels countries and list them in two rows of 9 each (9countries per row)... Hoever if there are more than 1 hotel then a javacript layer woudl show when you mouseover, showing the hotels situated in that country. if only one hotel in a country then it will simply list the country. somwhere along these lines my Javascriptiing is going bad where it lists all the countries+1 see my code below: <cfparam name="ATTRIBUTES.destId"> <cfquery name="getDestHotelList" datasource="#APPLICATION.db_datasource#" username="#APPLICATION.db_username#" password="#APPLICATION.db_password#"> SELECT hotelId, hotelCode, hotelName, countrycode FROM hotels WHERE hotelDestId = #ATTRIBUTES.destId# AND hotelPublished = 'Y' ORDER BY countrycode DESC limit 40 </cfquery> <cfparam name="CALLER.menuNo" default="1"> <cfset i = 1> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <tr> <td width="50%" align="left" valign="top" bgcolor="red"> <cfloop index="i" from="1" to="9" > <!--- Check for list ---> <cfif i LT getDestHotelList.recordCount AND getDestHotelList.countrycode[i+1] EQ getDestHotelList.countrycode[i]> <cfoutput><a href="##" name="popLink#CALLER.menuNo#" id="popLink#CALLER.menuNo#" onMouseOver="MM_showMenu(window.mm_menu#CALLER.menuNo#,100,0,null,'popLink#CALLER.menuNo#')" onMouseOut="MM_startTimeout();">#getDestHotelList.countrycode[i]# </cfoutput></a><br> <cfoutput> <script> function prepairMenu#CALLER.menuNo#(){ window.mm_menu#CALLER.menuNo# = new Menu("root",110,15,"Verdana, Arial, Helvetica, sans-serif",9,"##000000","##000000","##EEEEEE","##FF9900","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu#CALLER.menuNo#.addMenuItem("#JSStringFormat(getDestHotelList.hotelName[i])#","location='hotels/#JSStringFormat(getDestHotelList.hotelCode[i])#_home.cfm'"); <cfloop condition="i LT getDestHotelList.recordCount AND getDestHotelList.countrycode[i+1] EQ getDestHotelList.countrycode[i]"> <cfset i = i + 1> mm_menu#CALLER.menuNo#.addMenuItem("#JSStringFormat(getDestHotelList.hotelName[i])#","location='hotels/#JSStringFormat(getDestHotelList.hotelCode[i])#_home.cfm'"); </cfloop> mm_menu#CALLER.menuNo#.hideOnMouseOut=true; mm_menu#CALLER.menuNo#.bgColor='##555555'; mm_menu#CALLER.menuNo#.menuBorder=1; mm_menu#CALLER.menuNo#.menuLiteBgColor='##FFFFFF'; mm_menu#CALLER.menuNo#.menuBorderBgColor='##FFFFFF'; return true; } </script> </cfoutput> <cfset CALLER.menuNo = CALLER.menuNo + 1> <!--- Skip over this group ---> <!---<cfloop condition="i LT getDestHotelList.recordCount AND getDestHotelList.hotelAddress[i+1] EQ getDestHotelList.hotelAddress[i]"><cfset i = i + 1></cfloop>---> <cfelse> <a href="hotels/<cfoutput>#getDestHotelList.hotelCode[i]#_home.cfm"><cfif Len(getDestHotelList.countrycode[i])> </cfif><cfif Len(getDestHotelList.countrycode[i])> </cfif><cfif getDestHotelList.countrycode[i] NEQ "US"> #getDestHotelList.countrycode[i]# </cfif></cfoutput></a><br> </cfif> <font color="#770000"> <cfset i = i + 1> </font> </cfloop></td> <td width="50%" bgcolor="black"><cfloop index="i" from="10" to="20" > <!--- Check for list ---> <cfif i LT getDestHotelList.recordCount AND getDestHotelList.countrycode[i] EQ getDestHotelList.countrycode[i]> <cfoutput><a href="##" name="popLink#CALLER.menuNo#" id="popLink#CALLER.menuNo#" onMouseOver="MM_showMenu(window.mm_menu#CALLER.menuNo#,100,0,null,'popLink#CALLER.menuNo#')" onMouseOut="MM_startTimeout();">#getDestHotelList.countrycode[i]# </cfoutput></a><br> <cfoutput> <script> function prepairMenu#CALLER.menuNo#(){ window.mm_menu#CALLER.menuNo# = new Menu("root",110,15,"Verdana, Arial, Helvetica, sans-serif",9,"##000000","##000000","##EEEEEE","##FF9900","left","middle",3,0,1000,-5,7,true,true,true,0,true,true); mm_menu#CALLER.menuNo#.addMenuItem("#JSStringFormat(getDestHotelList.hotelName[i])#","location='hotels/#JSStringFormat(getDestHotelList.hotelCode[i])#_home.cfm'"); <cfloop condition="i LT getDestHotelList.recordCount AND getDestHotelList.countrycode[i+1] EQ getDestHotelList.countrycode[i]"> <cfset i = i + 1> mm_menu#CALLER.menuNo#.addMenuItem("#JSStringFormat(getDestHotelList.hotelName[i])#","location='hotels/#JSStringFormat(getDestHotelList.hotelCode[i])#_home.cfm'"); </cfloop> mm_menu#CALLER.menuNo#.hideOnMouseOut=true; mm_menu#CALLER.menuNo#.bgColor='##555555'; mm_menu#CALLER.menuNo#.menuBorder=1; mm_menu#CALLER.menuNo#.menuLiteBgColor='##FFFFFF'; mm_menu#CALLER.menuNo#.menuBorderBgColor='##FFFFFF'; return true; } </script> </cfoutput> <cfset CALLER.menuNo = CALLER.menuNo + 1> <!--- Skip over this group ---> <!---<cfloop condition="i LT getDestHotelList.recordCount AND getDestHotelList.hotelAddress[i+1] EQ getDestHotelList.hotelAddress[i]"><cfset i = i + 1></cfloop>---> <cfelse> <a href="hotels/<cfoutput>#getDestHotelList.hotelCode[i]#_home.cfm"><cfif Len(getDestHotelList.countrycode[i])> </cfif><cfif Len(getDestHotelList.countrycode[i])> </cfif><cfif getDestHotelList.countrycode[i] NEQ "US"> #getDestHotelList.countrycode[i]# </cfif></cfoutput></a><br> </cfif> <font color="#770000"> <cfset i = i + 1> </font> </cfloop></td> </tr> </table> <cfif Len(CALLER.getHotelDestNames.hotelDestSoonIn[ATTRIBUTES.destId])> <font color="#770000"><br> </font><br> <cfoutput>#replace( CALLER.getHotelDestNames.hotelDestSoonIn[ATTRIBUTES.destId], "#chr(10)#", "<br>", "ALL")#</cfoutput> </cfif> If anyone would like to help me out i would really appreciate it. I am a bit stuck here and a guiding hand would do wonders... Thanks in advance. _dancegruv |
|
#2
|
|||
|
|||
|
Could you please trim this code down to a short script that just demonstrates the actual problem? I don't have the time to read through all that code. Eliminate all the extraneous stuff.
__________________
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > CFM / Javascript help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|