Dojo )

Dojo ),dojo,readonly,checkbox,Dojo,Readonly,Checkbox,嗯, 汤姆非常感谢汤姆的建议。我是dojo新手,不知道place函数。我更改了代码,可以使用它并将新表单字段放在同一个div中。我使用的jsp片段使用以下spring标记: <%@taglib uri="http://www.springframework.org/tags" prefix="spring" %> 当它们位于片段的最顶端时,我会收到一个ajax错误,表示类型不匹配。我尝试完全删除它们,但随后字段将被放置,但没有值。最后我把它们放进了开场白,现在一切都好了 谢谢

嗯,


汤姆

非常感谢汤姆的建议。我是dojo新手,不知道place函数。我更改了代码,可以使用它并将新表单字段放在同一个div中。我使用的jsp片段使用以下spring标记:

<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>

当它们位于片段的最顶端时,我会收到一个ajax错误,表示类型不匹配。我尝试完全删除它们,但随后字段将被放置,但没有值。最后我把它们放进了开场白,现在一切都好了


谢谢你的帮助。

非常感谢汤姆的建议。我是dojo新手,不知道place函数。我改变了我的代码,我能够使用它并在同一个div中放置新的表单字段。我使用的jsp片段使用了以下spring标记:不用担心,很高兴能提供帮助。如果你认为我的答案是正确的,你应该检查一下,以便下次帮助别人找到:)
<script language="javascript">
    dojo.addOnLoad(passNumber);

    function passNumber() {
        var count = 0;
        dojo.query('#add').onclick(function() {
            var dNode = dojo.byId('more'+count);
            count++;
            dojo.xhrGet({url: 'add.html', 
                         handleAs: "text", 
                         preventCache: true,
                         content:{fieldId:count} ,
                    load: function(data) {
                        dNode.innerHTML = data;
                        dojo.parser.parse(dNode);
                    },
                    error: function(error) {
                        dNode.innerHTML += "AJAX error: " + error;
                    }
            });
        });
    }

</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">

    <head>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css">
    </head>

    <body class="claro ">
        <div id="container">
            <table id="original">
                <tr>
                    <td>
                        <input type="text" name="first" id="first" value="testing testing" dojoType="dijit.form.TextBox" trim="true" propercase="true">
                    </td><td>
                        <input type="text" name="second" id="second" value="testing testing" dojoType="dijit.form.TextBox" trim="true" propercase="true">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <select dojoType="dijit.form.FilteringSelect" id="third" name="third">
                            <option value="AP">
                                Apples
                            </option>
                            <option value="OR" selected>
                                Oranges
                            </option>
                            <option value="PE">
                                Pears
                            </option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="fourth" name="fourth" dojoType="dijit.form.CheckBox" value="agreed" checked>
                        <label for="mycheck">
                            I agree
                        </label>
                    </td>
                </tr>
            </table>
        </div>
        <div>
          <button dojoType="dijit.form.Button" type="button">
              Add new fields using HTML
              <script type="dojo/method" event="onClick" args="evt">
                  dojo.xhrGet({
                      url: '_data/mockBackendForXhrBuildDomExample.php',
                      handleAs: 'text',
                      preventCache: true,
                      load: function(data) {
                          // This is a little contrived, but hopefully you get the idea
                          console.log(data);
                          var container = dojo.byId('container');
                          var newTable = dojo.place(data, container, 'last');
                          dojo.parser.parse(newTable);                          
                      },
                      error: function(error) {
                          console.error(error);
                      }
                  });
              </script>
          </button>
        </div>
    </body>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
    djConfig="parseOnLoad: true">
    </script>
    <script type="text/javascript">
        dojo.require("dijit.form.FilteringSelect");
        dojo.require("dijit.form.TextBox");
        dojo.require("dijit.form.CheckBox");
        dojo.require("dijit.form.Button");
        dojo.addOnLoad(function() {


        });
    </script>

</html>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>