JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to reduce this code ???

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu
Author Message
vishalgupta



Joined: 12 Jun 2006
Posts: 8
Location: india

PostPosted: Mon Jun 12, 2006 7:31 am    Post subject: how to reduce this code ??? Reply with quote

actually im using below code.. to display the items stored in an array...
so i want to eliminate this code instead can i make use array index to refer to this line... of code..????
Code:

{code:"<b>"+clt[cl[0]].link[0]+"</b>",url:"./data/"+cl[0]+"/1.html","format":{"size":[18,150]}},


here is my menu item code.. included in meun.js

Code:
var MENU_ITEMS1 =
[
   {"pos":"relative", "itemoff":[0,210], "leveloff":[25,0], "style":STYLE, "size":[100,200], forms_to_hide:['first_form']},
   {code: "<center><b>"+clt[cl[0]].name+"</b></center>&nbsp;&nbsp; <img src=\"./data/"+cl[0]+"/snap.jpg\" width=\"75\" height=\"75\">&nbsp;&nbsp;&nbsp;<img valign=center src=\"./data/"+cl[0]+"/banner.gif\" width=\"88\" height=\"32\">", url:"http://"+clt[cl[0]].home, "target":"",
      sub:[
         {"style":STYLE1, "itemoff":[20,0], "leveloff":[80,25]},
         {code:"<center><b>"+clt[cl[0]].link[0]+"</b>",url:"./data/"+cl[0]+"/1.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[0]].link[1]+"</b>",url:"./data/"+cl[0]+"/2.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[0]].link[2]+"</b>",url:"./data/"+cl[0]+"/3.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[0]].link[3]+"</b>",url:"./data/"+cl[0]+"/4.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[0]].link[4]+"</b>",url:"./data/"+cl[0]+"/5.html","format":{"size":[18,150]}},
      ]   
   },
   {code:"<center><b>"+clt[cl[1]].name+"</b></center>&nbsp;&nbsp; <img src=\"./data/"+cl[1]+"/snap.jpg\" width=\"75\" height=\"75\">&nbsp;&nbsp;&nbsp;<img valign=center src=\"./data/"+cl[1]+"/banner.gif\" width=\"88\" height=\"32\">", url:"http://"+clt[cl[1]].home, "target":"",
      sub:[
         {"style":STYLE1, "itemoff":[20,0], "leveloff":[80,25]},
         {code:"<b>"+clt[cl[1]].link[0]+"</b>",url:"./data/"+cl[1]+"/1.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[1]].link[1]+"</b>",url:"./data/"+cl[1]+"/2.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[1]].link[2]+"</b>",url:"./data/"+cl[1]+"/3.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[1]].link[3]+"</b>",url:"./data/"+cl[1]+"/4.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[1]].link[4]+"</b>",url:"./data/"+cl[1]+"/5.html","format":{"size":[18,150]}},
      ]   
   },
   {code:"<center><b>"+clt[cl[2]].name+"</b></center>&nbsp;&nbsp; <img src=\"./data/"+cl[2]+"/snap.jpg\" width=\"75\" height=\"75\">&nbsp;&nbsp;&nbsp;<img valign=center src=\"./data/"+cl[2]+"/banner.gif\" width=\"88\" height=\"32\">", url:"http://"+clt[cl[2]].home, "target":"",
      sub:[
         {"style":STYLE1, "itemoff":[20,0], "leveloff":[80,25]},
         {code:"<b>"+clt[cl[2]].link[0]+"</b>",url:"./data/"+cl[2]+"/1.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[2]].link[1]+"</b>",url:"./data/"+cl[2]+"/2.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[2]].link[2]+"</b>",url:"./data/"+cl[2]+"/3.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[2]].link[3]+"</b>",url:"./data/"+cl[2]+"/4.html","format":{"size":[18,150]}},
         {code:"<b>"+clt[cl[2]].link[4]+"</b>",url:"./data/"+cl[2]+"/5.html","format":{"size":[18,150]}},
      ]   
   }
];


the array her i refer 'cl' is declared in another file.. ./data/data.js

thanx in advance..

-vishal
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Mon Jun 12, 2006 10:25 am    Post subject: Reply with quote

Looks like you need some function to transform your own structure into something that can be fed to COOLjsMenu. This is a customization, and we can do this for a small fee. Feel free to contact us at javascript@cooldev.com.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu All times are GMT
Page 1 of 1