6 messaggi dal 29 settembre 2001
Devo modificare un cod js contenebte del cod ASP
la parte ASP è:

<%
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ASP CODE START - READING ITEMS FROM THE DATABASE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
function readItemsFromDatabase(){
//The path to your database:
var db ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("menu.mdb")

var q = "SELECT menuID,mName,mLink,parent from tblMenu ORDER BY parent,menuID ASC"

var rs=Server.CreateObject("ADODB.Recordset")
rs.CacheSize = 25; // Cache data fetching
rs.CursorType = 3
rs.LockType = 3

//Opening database --- --
rs.Open(q,db)

//Now using getRows because that's so sexy :}
if(!rs.EOF){
var rsarr = rs.GetRows();
rsarr = rsarr.toArray();
var cols= rs.Fields.Count //Setting how much to add to row each for
}else var rsarr=new Array()

//Closing database, we don't need it anymore - we have the info in the array
rs.close()
rs = null

var menuID,mName,mLink,parent

for(row=0;row<rsarr.length;row+=cols){ //Looping rows
//Setting variables
menuID = "m" + rsarr[row]
mName = rsarr[row+1]
mLink = String(rsarr[row+2])
if(mLink=="null") mLink=""
parent = rsarr[row+3]
if(parent!=0) parent = "m" + parent
else parent=""
//Making menu item
Response.write("oCMenu.makeMenu('"+menuID+"','"+parent+"','"+mName+"','"+mLink+"')\n")
}
}
//Calling function
readItemsFromDatabase()

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ASP CODE END - READING ITEMS FROM THE DATABASE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
%>

che genera un output:
oCMenu.makeMenu('m1','','DADA','SHH')oCMenu.makeMenu('m2','','Top DAA','FDHDS')oCMenu. makeMenu('m3','m1','FABRY','DSFH')oCMenu
. makeMenu('m4','m1','CARBONI','HGSGHSD')o
CMenu.makeMenu('m5','m2','LAURA','SD')
oCMenu. makeMenu('m6','m2','RICCHIUTI','SDFHG')o
CMenu.makeMenu('m7','m3','MARCO','HSD')oCMenu.makeMenu('m8','m3','BETELLI','SDGHSDH')

ne più ne meno come questo di 10 righe in CFML

<cfquery name="link" datasource="#application.dsn#">
SELECT * FROM tblMenu
</cfquery>
<cfoutput query="link">
oCMenu.makeMenu('m#menuId#',
<cfif #parent# NEQ "">'m#parent#',
<cfelse>'',
</cfif>
'#mName#','#mlink#')
</cfoutput>

MI sono perso qualcosa forse visto che il js non funziona??
grazie



Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.