By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

Replacing forms

P: n/a
Hi everyone

I´m having some problems with replacing one form with another. The first
problem is the the replace function only works once - and the second problem
is that the thml code dosn´t get interpreted.. but is treated as plain text.
You can se a short example here:

http://www.schimkat.dk/forms.htm

Some hints on that one would be nice.

Regards Søren Schimkat
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Søren Schimkat wrote:
I´m having some problems with replacing one form with another. The first
problem is the the replace function only works once - and the second problem
is that the thml code dosn´t get interpreted.. but is treated as plain text.
You can se a short example here:

http://www.schimkat.dk/forms.htm


If you want to create an element with a certain element name with the
DOM then use
document.createElement('elementname')
so to create a HTML <form> element you use
var form = document.createElement('form');
then to create an <input> element you use
var input = document.createElement('input');
then if you want to have that <input> element as a child of the <form>
element then you have to put it there
form.appendChild(input);
To set HTML attributes you can use the HTML DOM where the attributes are
modelled as properties of the JavaScript objects so you might want to
set e.g.
form.action = 'whatever.php';
form.name = 'formName';
and
input.type = 'text';
input.name = 'inputName';
Finally to put the whole form into the document you can use e.g.
document.body.appendChild(form)
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.