06-23-2002, 10:22 PM
I'm trying to run this code
var LR = document.createElement(id);
the second line is not working. What is the problem ?
Thank you very much
Your usage of methods is incorrect for one:
Creates an element with tagName of 'someString':
Effectively creates a <img/> tag with no set attributes.
To set any attribute, you should do something like this for example:
var image = document.createElement('img');
image.setAttribute('alt', 'alternate text');
That effectively creates:
<img src="myimage.gif" width="100" height="50" alt="alternate text"/>
image = document.body.appendChild(image);
The image is now the lastChild of the html document's body, and the variable image refers to the live node in the document structure now.
Kind of make sense? :)
(Also going to move this to the DOM Scripting forum, slightly more appropriate...)
06-24-2002, 01:43 AM
if just need rendered outside document, like alert, maybe can ignore name attribute of element (or maybe not ???)
i tried with this
var LR = document.createElement('x').y='Hey You!'
"x" is not html tag element and "y" is not atributte element of "x", but for alert no need to append as html tag, tried at IE6 and NN6 working find, also i tried for status-bar, but NN6 can't work...????, anyone can find out this problem ? PLz correct if anything wrong, i learn programming just from book and internet. Thx.