"MC" <mica[removethis]@aisus.comwrites:
Hi,
I am looking to programmatically add an element to a form, in this case a
SPAN message.
<span class="Arial090NN" style="COLOR: red;LEFT: 85px; TOP: 176px; HEIGHT:
9px; TEXT-ALIGN: left; Z-INDEX: 100; POSITION: absolute;">My Message</span>
I've been looking on the web and I've not been able to find this. Any ideas?
see
http://www.w3.org/TR/REC-DOM-Level-1...e-binding.html
You probably want something like this:
var form = document.getElementById("id-of-form");
// or
var form = document.forms["name-of-form"];
var span = document.createElement("span");
span.className="Arial090NN"; // if this is what I think it is it's a really
// stupid class name - class names should be
// "semantic", not indicative of any particular style
span.style.color="red";
span.style.left="85px";
// etc
// usually you're better off putting styles in the appropriate class and/or id
// in a seperate stylesheet anyway
span.appendChild(document.createTextNode("My Message");
form.appendChild(span);
--
Joost Diepenmaat | blog:
http://joost.zeekat.nl/ | work:
http://zeekat.nl/