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?
Thanks,
Mica
see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-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/
You be the man! So many times I have needed this.
I agree on your comments but in this case it fits. This is a very complex
6-page form with many types of fonts that are standard accross a whole
library of forms.
Thank you AGAIN!
Mica
"Joost Diepenmaat" <jo...@zeekat.nl> wrote in message
news:87ve1gm...@zeekat.nl...