Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding innerHTML containing form
Message
De
19/10/2017 17:45:38
 
 
À
19/10/2017 04:44:16
Information générale
Forum:
Javascript
Catégorie:
DHTML
Divers
Thread ID:
01655077
Message ID:
01655085
Vues:
38
>Probably better to use .insertAdjacentHTML() : https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
.
.insertAdjacentHTML() inserts the HTML with afterbegin inside the div I wish to replace the innerHTML with. So, at first, I clear it. Then, I replace it.
loDiv=parent.document.getElementById("IFrameContainer")
loDiv.innerHTML=''
loDiv.insertAdjacentHTML('afterbegin',document.body.innerHTML)
This makes the page to look ok. However, the content of the form is not parsed as complete HTML tags. Thus, when posting, only the form values in their initial state is posted. What I change in the form is ignored.

beforeend inserts the HTML at the same place. Because I clear the div innerHTML at first, beforeend would result in the same as the first approach.

beforebegin inserts the HTML but breaks my page. Nothing is even posted to the server.

afterend inserts the HTML at the end of the page. Nothing is even posted to the server.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform