I found this code on the internet of dynamically adding textarea.
I know how to submit a textarea content into a database(access) but I dont know how to start with these codes because textareas are generated dynamically instead of static…. Can someone suggest??
thanks,kell
<HTML>
<HEAD>
<SCRIPT>
if (document.layers)
window.setResizable(false);
var c = 0;
function addTextArea (form) {
if (document.all) {
var html = ‘<BR><TEXTAREA NAME=”aTextArea’ + c++ + ‘” ROWS=”5″ COLS=”40″></TEXTAREA>’;
form.insertAdjacentHTML(‘beforeEnd’, html)
}
else if (document.getElementById) {
var textarea = document.createElement(‘TEXTAREA’);
textarea.name = ‘aTextArea’ + c++;
textarea.rows = 5;
textarea.cols = 40;
form.appendChild(document.createElement(‘BR’));
form.appendChild(textarea);
}
else if (document.layers) {
var l = new Layer (window.innerWidth);
var html = ”;
html += ‘<HTML><BODY><FORM NAME=”formName”>’;
html += ‘<TEXTAREA NAME=”aTextArea” ROWS=”5″ COLS=”40″></TEXTAREA>’;
html += ‘</FORM></BODY></HTML>’;
l.document.open();
l.document.write(html);
l.document.close();
l.top = document.height;
document.height += l.document.height;
l.visibility = ‘show’;
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME=”formName”>
<INPUT TYPE=”button” VALUE=”add textarea” ONCLICK=”addTextArea(this.form)”>
</FORM>
</BODY>
</HTML>