我已经构建了使用AJAX从数据库生成菜单和子菜单的javascripts,在菜单中选择选项之后,我希望它将它传递给下一个检索该选项子菜单的脚本。 Javascript代码是:
// Set connection parameters; usually loaded from a properties file.
String uri = "http://server:port/wsi/FNCEWS40MTOM/";
String username = "username";
String password = "password";
// Make connection.
Connection conn = Factory.Connection.getConnection(uri);
Subject subject = UserContext.createSubject(conn, username, password, null);
UserContext.get().pushSubject(subject);
try
{
// Get default domain.
Domain domain = Factory.Domain.fetchInstance(conn, null, null);
System.out.println("Domain: " + domain.get_Name());
// Get object stores for domain.
ObjectStore os = Factory.ObjectStore.fetchInstance(domain, "OS_Name", null);
// Build the query you want to use here
// Add the attributes you want, the document class you're interested in, etc.
String sqlstr = "SELECT [This], [createdBy], [createdDate] FROM [docClass] WHERE ([IsCurrentVersion] = TRUE) AND Document.This INFOLDER '/f1/f2'";
SearchSQL sql = new SearchSQL(sqlstr)
SearchScope scope = new SearchScope(os);
IndependentObjectSet docs = scope.fetchObjects(sql, 1000, null, true);
// Get the page iterator
PageIterator p = docs.pageIterator();
// Loop through each page
while(p.nextPage())
{
// Loop through each item in the page
for(Object objct : p.getCurrentPage())
{
// Get the document object and write Document Title
Document doc = (Document)objct;
Properties props = doc.getProperties();
String creator = props.getStringValue("createdBy");
Date creationDate = props.getDateTimeValue("creationDate");
// Now that you have the values, do what you want with them :)
}
}
}
如您所见,它将URL值附加到每个生成的ID为id的链接。当我选择链接时,它会转到另一个窗口,其他js文件是,但该文件只捕获主菜单href而不是附加一个参数,这就是为什么我无法从数据库中检索子菜单元素。问题是,如何在点击时立即将href更改为带参数的参数?谢谢