473,382 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Add Element to Form

MC
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?

Thanks,
Mica
Jun 27 '08 #1
2 1570
"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/
Jun 27 '08 #2
MC
Joost,

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.nlwrote in message
news:87************@zeekat.nl...
"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/

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
1
by: Stanimir Stamenkov | last post by:
Here's an example: <form action="bogus" method="post"> <p> <a href="prev.cgi"><input type="submit" name="prev" value="< Back"></a> <a href="next.cgi"><input type="submit" name="next"...
8
by: Stan Brown | last post by:
http://oakroadsystems.com/nonce/zonk.htm (12 lines) >...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
3
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and...
13
by: Noa | last post by:
Hi I have a page that looks like that: <form name="kuku1" action ="anotherpage.html" > <input name="name"> <input name="kuku2"> </form> As far as i know, "getAttribute" should return a...
15
by: Christoph | last post by:
I'm trying to make it so that if the user sets focus to a form element (text), it automatically sets focus to the very next form element. This will, in effect, prevent the user from modifying the...
2
by: yawnmoth | last post by:
Say I have two input elements and that I wanted to make it so that when the first ones input was what it should be, the focus would automatically be shifted to the next input element. ie....
3
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.