Да, но у меня, как вы видите, клонируются поля, поэтому оно в ФФ не работает. А как сделать так, чтоб заработало.
Код обновил, выкладываю скрипт и хтмл:
// JavaScript Document
var counter = 0;
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
var theId = newField[i].id
if (theName)
newField[i].name = theName + counter;
if (theName == "sexImage") {
stringToadd = "<img name='childSexMama"+counter+"' src='../_img/regform50.gif' width='50px' height='50px' onClick=\"document.forms['form1'].elements['iChildSex" + counter + "'].value='Девочка';changeChildSex(this,"+counter+")\"><img name='childSexPapa"+counter+"' src='../_img/regform50.gif' width='50px' height='50px' onClick=\"document.forms['form1'].elements['iChildSex" + counter + "'].value='Мальчик';changeChildSex(this,"+counter+")\">";
stringToadd += "<a href='#' onclick='moreFields();' >a</a>";
if (counter != 1) {
stringToadd += "<a href='#' onclick='deleteChild(this);' >x</a>";
}
stringToadd += "<input name='iDay' type='text' class='input2symb' id='iDay' size='5' maxlength='2' />.<input name='iMonth' type='text' class='input2symb' id='iMonth' size='5' maxlength='2' />.<input name='iYear' type='text' class='input15symb' id='iYear' size='9' maxlength='4' /><input type='hidden' name='iChildSex' value='Мальчик' id='childSex' />";
newField[i].innerHTML = stringToadd;
}
}
var insertHere = document.getElementById('writeroot');
insertHere.parentNode.insertBefore(newFields,insertHere);
}
window.onload = moreFields;
function changeSex(obj) {
obj.className = "imgBorder";
if (obj.name == "mama") {
document.images['papa'].className = "imgNoBorder";
document.forms['form1'].elements['iSex'].value = "Мама";
}
if (obj.name == "papa") {
document.images['mama'].className = "imgNoBorder";
document.forms['form1'].elements['iSex'].value = "Папа";
}
}
function changeChildSex(obj, number) {
// alert("childSexMama"+number);
obj.className = "imgBorder";
// alert(obj.name);
// if (myString.match(/regex/)) { /*Success!*/ }
if (obj.name == "childSexMama"+number) {
// alert('childSexPapa'+number);
document.images['childSexPapa'+number].className = "imgNoBorder";
}
if (obj.name == "childSexPapa"+number) {
document.images['childSexMama'+number].className = "imgNoBorder";
}
}
function deleteChild (obj) {
obj.parentNode.parentNode.removeChild(obj.parentNode);
}
<div style="position: absolute; top: 45px; left: 311px; z-index: 5;">
<form id="form1" name="form1" method="post" action="index.php">
<table width="663" align="center">
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="center"><input name="childs" type="hidden" id="childs" value="<?php echo $childs; ?>" /></td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="center"> </td>
</tr>
<tr>
<td width="101" align="left">Имя *</td>
<td width="270" align="left"><input name="iLogin" type="text" class="input15symb" id="iLogin" value="<?php echo $iLogin; ?>" maxlength="15" /></td>
<td width="270" align="center">
<img name="mama" src="../_img/regform50.gif" width="50" height="30" onclick="changeSex(this)"/>Я мама
<img name="papa" src="../_img/regform50.gif" alt="" width="50" height="30" onclick="changeSex(this)"/>Я папа
<input name="iSex" type="hidden" id="iSex" /></td>
</tr>
<tr>
<td align="left">email *</td>
<td align="left"><input name="iEmail" type="text" class="input30symb" id="iEmail" value="<?php echo $iEmail; ?>" maxlength="30" /></td>
<td align="left"><p>Подтверждение пароля </p></td>
</tr>
<tr>
<td align="left">Пароль *</td>
<td align="left"><input name="iPassword" type="password" class="input30symb" id="iPassword" size="10" maxlength="30" /></td>
<td align="left"><input name="iPassword2" type="password" class="input30symb" id="iPassword4" maxlength="30" /></td>
</tr>
<tr>
<td align="left">Город *</td>
<td align="left"><select name="iCity" class="input30symb" id="iCity">
<?php include("cities.php");?>
</select></td>
<td> </td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="center"> </td>
</tr>
<tr>
<td align="left">Дети</td>
<td align="center">День рождения</td>
<td align="center"> </td>
</tr>
<tr>
<td align='center'></td>
<td colspan='2' align='left'>
<div id="readroot" style="display: none">
<div name="sexImage" id="sexImage"></div>
</div>
<span id="writeroot"></span>
</td>
</tr>
<tr>
<td align="left"> </td>
<td align="center">Проверочный код</td>
<td align="center"> </td>
</tr>
<tr>
<td align="left"> </td>
<td colspan="2" align="center"><input name="iSpamCode" type="text" class="input15symb" id="iSpamCode" />
<input name="fff" type="text" disabled="disabled" class="input15symb" id="iSpamCode4" value="<?php echo $spamcode; ?>" />
<input name="iCorrectSpamCode" type="hidden" id="iCorrectSpamCode" value="<?php echo $spamcode; ?>" /></td>
</tr>
<tr>
<td align="left"> </td>
<td colspan="2" align="left"><input name="iAgreeWithOferta" type="checkbox" id="iAgreeWithOferta" value="true" />
-
Я соглашаюсь с условиями публичной оферты</td>
</tr>
<tr>
<td align="left"> </td>
<td colspan="2" align="center"><input type="submit" name="Submit" id="Submit" value="Регистрация" /></td>
</tr>
<tr>
<td align="left"> </td>
<td colspan="2" align="center"> </td>
</tr>
</table>
</form>
</div>