Hallo, habe folgendes Javascript
:
Code:
//input field generator
function addField(pre,post,formtable,before)
{
var node = document.createElement("tr");
var td = node.appendChild(document.createElement("td"));
var input = td.appendChild(document.createElement("input"));
input.setAttribute("type", "text");
input.setAttribute("name", "usernames[]");
var cb = td.appendChild(document.createElement("input"));
cb.setAttribute("type", "checkbox");
cb.setAttribute("name", "encryptmd5[]");
td.appendChild(document.createTextNode(" MD5 verschlüsseln"));
if (pre != null)
formtable.appendChild(pre);
if (before != null)
formtable.insertBefore(node,before); //<--hier
else
formtable.appendChild(node);
if (post != null)
formtable.appendChild(post);
}
ganz unten, bei der markierten anweisung kommt eine
exception:
Zitat:
Fehler: uncaught
exception: [
Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "file:///E:/WEB/xampp/htdocs/develop/htusers_generator/htusers.js Line: 24"]
Das
HTML sieht so aus:
Code:
<form action="htuser.php">
<table id="formtable">
<tr id="before"><td><input type="reset" value="Reset"><input type="submit" value="Abschicken"></td></tr>
</table>
</form>
ich hole mit das before vorher:
Code:
function Init()
{
var formtable = document.getElementById("formtable");
var before = document.getElementById("before");
addField(null,null,formtable,before);
}
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1