Hi! I'm using the following script to clone some fields on a PHP form soh that the users can add more links.Everything works great, but there is this one thing that I don't know how to do it because I'm really a starter in JS.On my <select>, I have <options> that has to be enumerated.. like Link 1, Link 2, Link 3 and I don't know how to do it...The code I'm using is the following:
<script language="javascript">var counter = -1;function moreFields(X){counter++;var newFields = document.getElementById('readroot' + X).cloneNode(true);newFields.id = '';newFields.style.display = 'block';var newField = newFields.childNodes;for (var i=0;i<newField.length;i++){var theName = newField[i].nameif (theName)newField[i].name = theName + '[' + counter + ']';}var insertHere = document.getElementById('writeroot' + X);insertHere.parentNode.insertBefore(newFields,insertHere);}</script><input type="button" value="+ E-mails" onClick="moreFields(2)"><div id="readroot2" style="display:none;" > Texto: <select name='texto[]' class='field' onchange='email_text(this)'> <option value='Email 1' selected='selected'>E-mail 1</option> <option value='Link 1'>Link 1</option> <option>Other</option></select> E-mail/Link: <input name="email" type="text" id="email" value="" size="20" /></div><div id="writeroot2"></div>
I hope someone can help!!.. PLZZZZZ!!!!!!