vishalgupta
Joined: 12 Jun 2006 Posts: 8 Location: india
|
Posted: Mon Jun 12, 2006 7:31 am Post subject: how to reduce this code ??? |
|
|
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> <img src=\"./data/"+cl[0]+"/snap.jpg\" width=\"75\" height=\"75\"> <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> <img src=\"./data/"+cl[1]+"/snap.jpg\" width=\"75\" height=\"75\"> <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> <img src=\"./data/"+cl[2]+"/snap.jpg\" width=\"75\" height=\"75\"> <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 |
|