[Javascript] Appending an input to a form in Internet Explorer

German Sibay gsibay at hexacta.com
Wed Mar 23 15:50:51 CST 2005


It does not work =(
Same error.
I´ve also tried "input" instead of "INPUT"
I´m all ears (or eyes)

-----Original Message-----
From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu] On Behalf Of Robert Crawford
Sent: Wednesday, March 23, 2005 6:46 PM
To: [JavaScript List]
Subject: Re: [Javascript] Appending an input to a form in Internet Explorer

German Sibay said the following on 3/23/2005 3:19 PM:

> Hello, I´m trying to append an input field to a form.. seems easy.
>
> It works on Mozilla but it does not in IExplorer.
>
> The last line (the append) throws an error "invalid argument"
>
> Any clue?
>
> function addInputField (form, fieldType, fieldName, fieldValue) {
>
> var input = document.createElement("INPUT");
>
> input.setAttribute('type', fieldType);
>
> input.setAttribute('name', fieldName);
>
> input.setAttribute('value', fieldValue);
>
> form.appendChild(input);
>
> }
>
> Germán Sibay
>

German,

Have tried this way;

function addInputField (form, fieldType, fieldName, fieldValue) {

var input = document.createElement("INPUT");

form.appendChild(input);

input.setAttribute('type', fieldType);

input.setAttribute('name', fieldName);

input.setAttribute('value', fieldValue);

}

This gives it the same order as your function output.

Just a thought ....

Robert



_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list