473,699 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

part of a FORM inside DIV block

i have a block of html code looking like this

<FORM name=myform>
<INPUT type=text name=firstname>
<DIV id=mydiv>
<INPUT type=text name=address>
</DIV>
</FORM>

i can access firstname field with document.myform .firstname

but how to reference to address field which is inside a DIV block.
nor document.myform .mydiv.address neither
document.myform .mydiv.document .address works

any ideas? this is realy kickin' my ass.
Jul 20 '05
18 7241
Dr John Stockton wrote:
[...] Thomas 'PointedEars' Lahn
Your `From:' header does not contain an e-mail address and is therefore
invalid, so you are violating Internet standards, helping to destroy the
Internet. ---> http://www.interhack.net/pubs/munging-harmful/
[flame]
I advise you to stop nagging;


I do not nag, I advise people not to destroy working structures.
If I would have time for it, I would pity you for not understanding this.
it makes you look foolish.


Well, that is your opinion and based on what you showed here regarding
Usenet/Internet Standards, I don't give a ... cent on it.
PointedEars
Jul 20 '05 #11
Thomas 'PointedEars' Lahn wrote:
Dr John Stockton wrote:
[...] Thomas 'PointedEars' Lahn
Your `From:' header does not contain an e-mail address and is therefore
invalid, so you are violating Internet standards, helping to destroy the
Internet. ---> http://www.interhack.net/pubs/munging-harmful/


[flame]
I advise you to stop nagging;


I do not nag, I advise people not to destroy working structures.
If I would have time for it, I would pity you for not understanding this.


How does it destroy a working structure?

He posted to Usenet, you read it, you replied, I read both the original post
and the reply, seems to be working fine to me.
it makes you look foolish.


Well, that is your opinion and based on what you showed here regarding
Usenet/Internet Standards, I don't give a ... cent on it.


And your one-man crusade to "save" Usenet and the Internet at large is unlikely
to produce any noticable effect.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #12
Grant Wagner wrote:
Thomas 'PointedEars' Lahn wrote:
Dr John Stockton wrote:
> [...] Thomas 'PointedEars' Lahn
>> Your `From:' header does not contain an e-mail address and is therefore
>> invalid, so you are violating Internet standards, helping to destroy the
>> Internet. ---> http://www.interhack.net/pubs/munging-harmful/
>
> [flame]
> I advise you to stop nagging;
I do not nag, I advise people not to destroy working structures.
If I would have time for it, I would pity you for not understanding this.


How does it destroy a working structure?

He posted to Usenet, you read it, you replied, I read both the original post
and the reply, seems to be working fine to me.


Obviously you did not read before you post, following the above link,
> it makes you look foolish.


Well, that is your opinion and based on what you showed here regarding
Usenet/Internet Standards, I don't give a ... cent on it.


And your one-man crusade to "save" Usenet and the Internet at large is unlikely
to produce any noticable effect.


nor have you any idea of Netiquette
--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html


and how disregarding it destroys working structures. *PLONK*
PointedEars
Jul 20 '05 #13
DU
Thomas 'PointedEars' Lahn wrote:
DU wrote:

Lasse Reichstein Nielsen wrote:
DU <dr*******@hotW IPETHISmail.com > writes:

Lasse Reichstein Nielsen wrote:

>The appropriate and standards[1] sanctioned way to access a form
>control is:
>document.f orms['myform'].elements['address']

document.fo rms[0].elements.named Item("address")

is perfectly standard and works without a glitch in Mozilla 1.5, Opera
7.23, MSIE 6 for windows and K-meleon 0.8.

So is and does
document.forms['myform'].elements['address']
(ok, I haven't checked K-meleon, but it's Gecko-based)
We understand each other.

I am afraid you did not understand.


I was merely mentioning another W3C-web-standards way of accessing a
form control. Lasse's initial answer somewhat suggested there was only 1
way.
All I wanted to say is that there is just one appropriate way
conforming to W3C web standards to access that node and its value.


It should have been saying "... there is not just one appropriate
way...". Somehow I forgot to write the "not" word. My initial reply was
clearly suggesting there is more than 1 W3C web standard way to access a
form control.

But you are wrong, read again. There are exactly four possibilities
of accessing a form element in a standards-compliant way
Exactly four? There are other web standard compliant ways to access a
form element. You can give a form element an id attribute and then
access it with getElementById method. Roughly 96% (and still growing) of
all browsers in use out there support that method. NN 3.x, NN 4.x, IE
3.x and IE 4.x do not support getElementById though.

: The namedItem(...) method, the index operator with a string operand, the
item(...) method and the index operator with a numeric operand. The
index operator (`[...]'), however is also downwards compatible as the
`document.forms ' and `elements' collections or arrays were already part
of "DOM Level 0"
DOM Level 0 is not a technical recommendation from the W3C. Never was.

from IE 3.0 and NN 3.0 on while the namedItem(...) and item(...) methods were not.
Are you saying people should not be using namedItem or item because IE
3.0 and NN 3.0 do not support these methods? Is that what you are
actually saying? IE 3.0 and NN 3.0 were designed and developed 8 years
ago, you know.
And what about other methods? NN 3.x, IE 3.x, NN 4.x and IE 4.x do not
support about every possible DOM 1 methods (including those which
generates HTMLCollections , nodeLists and NamedNodeMaps) and attributes
listed in W3C TRs. Would you go as far as saying we should not use any
of them because NN 3.x, IE 3.x, NN 4.x and IE 4.x do not support them as
well? and so forth for CSS1 properties, HTML 4 elements, attributes,
etc. that are either not supported or not working well in NN 3.x, NN
4.x, IE 3.x and IE 4.x?

So the saner way is using the index operator as Lasse suggested.
PointedEars


Lasse's initial reply did not make use of the index with an numeric
operand; I was the first to mention and use it in this thread.

DU

Jul 20 '05 #14
DU
Thomas 'PointedEars' Lahn wrote:
Dr John Stockton wrote:

[...] Thomas 'PointedEars' Lahn
Your `From:' header does not contain an e-mail address and is therefore
invalid, so you are violating Internet standards, helping to destroy the
Internet. ---> http://www.interhack.net/pubs/munging-harmful/
[flame]
I advise you to stop nagging;

I do not nag,


You nag. You admonish on spelling, on fixing news readers, on quoting
manners. You try to domesticate people on their posting manners, on
their quoting manners, on adding a semi-colon here, you then call them
scriptkiddies, you give them bullshit, etc.. You nitpick on top of all
that. Your tone is an authoritative one also: you just say "do this,
don't do that" but you rarely address the intelligence of people by
explaining to them the positive benefits of doing what you claim to
promote. This is a newsgroup on javascript, you know; not a place to
consolidate your nanny manners.
I advise people not to destroy working structures.
Spammers are destroying working structures: Yahoo!.com, Microsoft and
AOL recently understood that. Spammers undermine trust, confidence.
Successful scams achieved on the web thanks to spams are the ones which
destroy working structures. 2 billions junk emails of traffic per day
traveling among US servers is what is destroying working structures.
And what you said has no common measure with what I do with my email
address in a newsgroup. There is a magnitude of difference in
destruction between what spammers have done over the years and what I
have been doing in this newsgroup for the last 2 years that your post
absolutely ignore: your choice of word is senseless.
If I would have time for it, I would pity you for not understanding this.

it makes you look foolish.

Well, that is your opinion and based on what you showed here regarding
Usenet/Internet Standards, I don't give a ... cent on it.
PointedEars


Your reply to me in this thread was quite stunning to say the least. My
"from" header contains my email address. Claiming I violate Internet
standards and then adding that I help destroy the Internet is foolish.

DU

Jul 20 '05 #15
DU
Thomas 'PointedEars' Lahn wrote:
Grant Wagner wrote:

Thomas 'PointedEars' Lahn wrote:
Dr John Stockton wrote:

[...] Thomas 'PointedEars' Lahn

>Your `From:' header does not contain an e-mail address and is therefore
>invalid, so you are violating Internet standards, helping to destroy the
>Internet . ---> http://www.interhack.net/pubs/munging-harmful/

[flame]
I advise you to stop nagging;

I do not nag, I advise people not to destroy working structures.
If I would have time for it, I would pity you for not understanding this.
How does it destroy a working structure?

He posted to Usenet, you read it, you replied, I read both the original post
and the reply, seems to be working fine to me.

Obviously you did not read before you post,


This is insulting, I would say. You obviously can not know for sure if
Grant did or did not read that document. Nevertheless, you just say he
did not, just like that.

following the above link,
You did not write that document either. Why should we automatically go
to that url and read the referenced documents you mention? That document
is not even about javascript. That document is far from demonstrating
the damages done by email address munging.
it makes you look foolish.

Well, that is your opinion and based on what you showed here regarding
Usenet/Internet Standards, I don't give a ... cent on it.
And your one-man crusade to "save" Usenet and the Internet at large is unlikely
to produce any noticable effect.

nor have you any idea of Netiquette


You just authoritatively say others have no netiquette. "Plonk"-ing
people like you do can not promote your ideas in any way and will not
document your own claims about email address munging.

I have known Grant W. for over 2 years from the posts he wrote in this
newsgroup. From a c.l.javascript newsgroup perspective and from an
evangelization of good, sound compliance of web standards, sound coding
practices/techniques, I would say he's a patient, reasonable, moderate
person. He does not try to battle with others. I'm sure he would not
reply to you the way he did without solid reasons.
--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

and how disregarding it destroys working structures. *PLONK*
PointedEars


A very wide majority of reasonable people would not adamantly persist in
saying that modifying an email address is destroying working internet
structures.
PointedEars, you have rigid manners with people. Simple as that.

DU

Jul 20 '05 #16
DU <dr*******@hotW IPETHISmail.com > writes:
Lasse's initial reply did not make use of the index with an numeric
operand; I was the first to mention and use it in this thread.


That was quite deliberate. I dislike programming with "magic numbers",
and prefer to use names whenever possible. Using numeric indices is
not stable wrt. changes on the page.

It is correct that it works, and in some cases might be useful, but I
recommend against it. It makes for fragile code.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #17
DU
Lasse Reichstein Nielsen wrote:
DU <dr*******@hotW IPETHISmail.com > writes:

Lasse's initial reply did not make use of the index with an numeric
operand; I was the first to mention and use it in this thread.

That was quite deliberate. I dislike programming with "magic numbers",
and prefer to use names whenever possible.


I dislike resorting to numbers too. I always prefer meaningful,
intuitive, self-explanatory identifiers for name values, id values and
for functionName, variables, etc.. This simple code-naming policy helps
tremendously understanding, maintaining, reusing, reviewing (by others)
and debugging a source code.

Using numeric indices is not stable wrt. changes on the page.

The exception I apply (regarding such code naming policy) is about forms.
1- When I code a page, I want it to be as forward-compatible as possible
and as ready/easy to convert to XHMTL strict as possible; so I avoid
using the name attribute for forms elements.
E.g.: document.forms['myform'].elements['address']
can involve a compliant document in XHTML 1.0 strict and XHTML 1.1 only
if "myform" is the id value of the form.
2- I very rarely have more than 1 form in a webpage I build (1), so I
don't see the need to use the id attribute for it. In such case, when I
have a single form, I usually give significant id attribute values to
elements which will need to be accessed in script functions and then use
document.getEle mentById("FormC ontrolId"), otherwise
document.forms[0].elements["FormControlNam e"] or
document.forms[0].elements.named Item("FormContr olName")
And if I have 2 forms (which is quite rare for me), then I just use
document.forms[0] and document.forms[1] accordingly, that is if I can't
reach, access form controls via document.getEle mentById. I remember
starting a thread (in this newsgroup I think) on this querying what was
the best (efficient) way to access form elements.
It is correct that it works, and in some cases might be useful, but I
recommend against it. It makes for fragile code.

/L


DU
(1) I don't want the user to be confronted to 2 submit buttons, 2 reset
buttons for the sake of interface clarity and eliminating possible
source of confusion. I believe there should be at most only 1 form
submit button per webpage.
Jul 20 '05 #18
DU <dr*******@hotW IPETHISmail.com > writes:
The exception I apply (regarding such code naming policy) is about forms.
1- When I code a page, I want it to be as forward-compatible as
possible and as ready/easy to convert to XHMTL strict as possible; so
I avoid using the name attribute for forms elements.
Reasonable.
E.g.: document.forms['myform'].elements['address']
can involve a compliant document in XHTML 1.0 strict and XHTML 1.1 only
if "myform" is the id value of the form.
And ofcourse it is. The name attribute is deprecated on the form
element. The index of form controls in the elements collection is
easier to handle, as it only changes when you change the form, not
when you change the rest of the page.

The only problem is Netscape 4, which is no big surprice.
2- I very rarely have more than 1 form in a webpage I build (1), so I
don't see the need to use the id attribute for it. In such case, when
I have a single form, I usually give significant id attribute values
to elements which will need to be accessed in script functions and
then use document.getEle mentById("FormC ontrolId"),
It has the advantage of working without a form element too. The forms
I make are usually meant for client-side processing, so the form
element makes no sense (except for keeping Netscape 4 happy, and I why
should I - I don't even like it :)

(1) I don't want the user to be confronted to 2 submit buttons, 2
reset buttons for the sake of interface clarity and eliminating
possible source of confusion. I believe there should be at most only 1
form submit button per webpage.


If the layout is clear, I don't think it is a problem (that includes
things like a form and a small login box - name/passwd/submit).
Wrap both forms in fieldset elements or other distingusihing wrappers.
I agree that it can become confuzing if not treated carefully.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #19

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

Similar topics

4
7421
by: mappo | last post by:
There are about a million posts on how to get rid of the extra space _after_ the form end-tag, but I can't find any that solve my problem: extra space _in_ the form tag. I have a table nestled inside the form and since I want the submit button underneath the input text field i have a br tag to separate them. For some reason IE5.5 gives me what seems like two br tags. It looks good in Opera 7, and in K-Meleon 0.6 (Gecko).
9
2464
by: Markus Ernst | last post by:
Hi I am building an admin environment for a CMS system. For the issues described I have a testcase available at http://www.ernstdeslebens.ch/csstest/ I am sorry the links are not useable as they lead to password-protected pages; it is only this page for demonstration. Both HTML (strict) and CSS validate.
11
4168
by: Pete Wilson | last post by:
Hi folks -- The page at http://www.pwilson.net/submit-demo.html will not validate. The validator at http://validator.w3.org tells me I can't have an input inside a form. Would some kind soul please tell me what I'm doing wrong?
4
9958
by: Matthew Louden | last post by:
It happend to me more than once. When I create web controls or move the positions in VS.NET, I encountered the following run-time errors: It doesn't matter what controls I create, the following 'checkbox' control is just an example. Control 'CheckBox1' of type 'CheckBox' must be placed inside a form tag with runat=server. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
6
787
by: ste.paoletti | last post by:
hi, I have read that browsers support block element inside inline element but the css is not valid. Someone can tell me more about? What do you think? Thanks.
14
19369
by: Luciano A. Ferrer | last post by:
It is ok tu use a table tag inside a form tag? (you know, you do not use h2 inside p, etc...) -- Luciano A. Ferrer laferrerQuiTadme@SacaDMEgmail.com .... un todo en uno y uno en todo
5
2543
by: plumba | last post by:
Hi all I have a form (see below), which for some reason has decided to stop functioning all together. It just does not call up the function. It is called up in the opening <form> tag but fails.... Any ideas??? <html> <head><title>New Details</title> </head> <center> <H2><IMG SRC="$(path)smlogo.gif"><br>
6
2189
by: shapper | last post by:
Hello, I am creating a form that includes a few JQuery scripts and TinyMCE Editor: http://www.27lamps.com/Beta/Form/Form.html I am having a few problems with my CSS: 1. Restyling the Select
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9034
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.