I sometimes need to add elements (such as a new link and image) to an existing HTML page, but I only have access to a small portion of the page far from where I need to inse
Nothing wrong with that. Using innerHTML
would be marginally faster and probably fewer characters but not noticeable for something of this scale, and my personal preference is for the more standard, uniformly supported and safer DOM methods and properties.
One minor point: the height
and width
properties of
elements should be numbers rather than strings.