Fix element id:s for dynamically added elements

This commit is contained in:
Anders Betnér 2006-05-20 22:37:41 +00:00
parent 5eba5fc5ac
commit 8c969a9367

View File

@ -9,7 +9,6 @@ Event.observe(window,'load',init);
else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1) else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
navigator.OS = 'nix';*/ navigator.OS = 'nix';*/
//Inform user if server restart needed //Inform user if server restart needed
//disable all page elements when read only
//better errormessage for not writable config //better errormessage for not writable config
//make tabs? //make tabs?
//create the path/file browser //create the path/file browser
@ -243,8 +242,13 @@ var Config = {
} }
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
span = span.cloneNode(true); span = span.cloneNode(true);
span.getElementsByTagName('label')[0].setAttribute('for','hej'); var id = span.getElementsByTagName('input')[0].id;
span.getElementsByTagName('input')[0].id = 'hej'; var num = parseInt(id.match(/\d+$/));
num++;
var id = id.replace(/\d+$/,'') + num;
span.getElementsByTagName('label')[0].setAttribute('for',id);
span.getElementsByTagName('input')[0].id = id;
span.getElementsByTagName('input')[0].value = ''; span.getElementsByTagName('input')[0].value = '';
var hrefs = span.getElementsByTagName('a'); var hrefs = span.getElementsByTagName('a');
if ('Netscape' == navigator.appName) { if ('Netscape' == navigator.appName) {