Appending new HTML elements with JavaScript across framesets
Opera supports W3C DOM-compatible methods for altering documents, such as document.createElement. If these methods are used with framesets, webmasters should note that Opera implements a security restriction that means elements can only be appended to the document they are created within.
For instance, assuming a JavaScript in one frame wants to append OPTION elements to a SELECT in a frame called "menuframe". The following code shows how to call createElement from the document where the new element should be appended:
option = top.menuframe.document.createElement("option");
option.setAttribute("text", "New option");
top.menuframe.document.getElementById("selectMenu").appendChild(option);
Browse through articles in the same categories:
unsorted
Search our knowledge base:
