Replacing forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Søren Schimkat

    Replacing forms

    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:



    Some hints on that one would be nice.

    Regards Søren Schimkat


  • Martin Honnen

    #2
    Re: Replacing forms



    Søren Schimkat wrote:
    [color=blue]
    > 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[/color]

    If you want to create an element with a certain element name with the
    DOM then use
    document.create Element('elemen tname')
    so to create a HTML <form> element you use
    var form = document.create Element('form') ;
    then to create an <input> element you use
    var input = document.create Element('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.appendChil d(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.a ppendChild(form )
    --

    Martin Honnen


    Comment

    Working...