/    Sign up×
Community /Pin to ProfileBookmark

dynamically added textarea

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>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kellyin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...