0

在这里,我使用 javascript 获取计数器值。我想将这些计数器值插入到我的数据库中。我该怎么做?请给我建议。

<script language="JavaScript">
var counter = 1;

function moreFields() {
    counter++;
    var newFields = document.getElementById('readroot').cloneNode(true);
    newFields.id = '';
    newFields.style.display = 'block';
    var newField = newFields.childNodes;
    for (var i = 0; i < newField.length; i++) {
        var theName = newField[i].name
        if (theName)
            newField[i].name = theName + counter;
    }
    var insertHere = document.getElementById('writeroot');
    insertHere.parentNode.insertBefore(newFields,insertHere);
}

window.onload = moreFields;
</script>
4

1 回答 1

0

请阅读W3school ajax 教程并单击“自己尝试”按钮,我相信您会很容易地得到它:)

于 2013-02-14T07:41:42.063 回答