Click to See Complete Forum and Search --> : Relation between SPAN and FORM elements


raghu
03-24-2003, 02:37 PM
I have got a html document with form and span element as mentioned below. I wanted to know is there a parent and child relation between the "form" ,"span" and "form elements" in JavaScript. For example using form id can I able to access all the span ids inside the FORM and similarly using form id and span id can I able to access the elements inside that specific FORM and SPAN using javascript.

<form id="firstform">

<span id="first" name="something" >
<input name="fname" type="text">
<input name="lname" type="text">
</span>

<span id="second" name="something" >
<input name="fname1" type="text">
<input name="lname1" type="text">
</span>

<span id="third" name="something" >
<input name="fname2" type="text">
<input name="lname2" type="text">
</span>

</form>

khalidali63
03-24-2003, 03:01 PM
If you want to know that span is a form element then no its not .

if I am completely out of the influence of saturday night then here is the list of form elements

form.textarea
form.text
form.fileupload
form.password
form.hidden
form.submit
form.reset
form.radio
form.checkbox
form.button
form.select
form.select.option

span is a w3c standard element just like id

Cheers

Khalid

nkaisare
03-24-2003, 03:52 PM
Also note that span is not a block-level element, so your usage is incorrect. use <div id="first" style="display:inline"> instead.

Since each form element has a unique name, you should not have any problems with javascript. If you are trying to turn display on or off of an entire span based on user input using javascript, you can always turn its visibility on or off. Dont know if this is what you are trying to do.

Khalid, <span> is an HTML element, id is an attribute :)

khalidali63
03-24-2003, 04:08 PM
your are right, I guess I just overlooked while writing it.id is attribute and span is an w3c standard element.

Khalid