我的JSP 页面有3个下拉框和文本框,分别是年,月,日
当我进入这个页面时 就从数据库中查出当前日期下的数据 放到文本框中
当我再改变下拉框时就再查询,对应改变后的日期的数据放到文本框中。该怎么做呢?
这些我希望都是不提交的情况下实现。拜托了

解决方案 »

  1.   

    var localComboId1 = "";
    var localComboId2 = "";
    var localComboId3 = "";
    function ajaxRelComboboxRefresh(systemCode, funcCode, processName, currentStatus, comboId1, comboId2, comboId3, formid) {   localComboId1 = comboId1;
       localComboId2 = comboId2;
       localComboId3 = comboId3;  // Obtain an XMLHttpRequest instance
      var req = newXMLHttpRequest();  // Set the handler function to receive callback notifications
      // from the request object
      var handlerFunction = handlerFunction = getReadyStateHandler(req, ajaxRelComboboxRefreshCallBackFunc);
      req.onreadystatechange = handlerFunction;  // Open an HTTP POST connection to the shopping cart servlet.
      // Third parameter specifies request is asynchronous.
      req.open("POST", "/roims/ActionServlet", true);  // Specify that the body of the request contains form data
      req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");  var paramStr = preparePostData(document.getElementById(formid));  // Send form encoded data stating that I want to add the 
      req.send("GUI_COMPONENT_PARAMETER_REL_COMBOID_1="+comboId1+"&GUI_COMPONENT_PARAMETER_REL_COMBOID_2="+comboId2+
      "&GUI_COMPONENT_PARAMETER_REL_COMBOID_3="+comboId3+"&functionCode="+funcCode+"&actionType="+processName+
      "&processName="+processName+ "&currentStatus="+currentStatus +"&fromSystem="+systemCode+paramStr);
    }function ajaxRelComboboxRefreshCallBackFunc(tabelXML) {
    document.all(localComboId3).length = 0;
    document.all(localComboId3).options.add(new Option("", ""));
    if (localComboId1 != null && localComboId1.length > 0) {
    document.all(localComboId2).length = 0;
    document.all(localComboId2).options.add(new Option("", ""));

    runPostActionScript(tabelXML);
    }function runPostActionScript(parentEle) {
    var scriptArr = parentEle.getElementsByTagName("script");
    for(var i = 0; i < scriptArr.length; i++) {
    var cmd = scriptArr[i].xml;
    cmd = cmd.replace("<script><![CDATA[", "");
    cmd = cmd.replace("]]></script>", "");
    try {
    window.eval(cmd);
    } catch (e) {

    }
    }
    }