473,466 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

do we need id attribute??

I want to know if we need id attribute? Or just name attribute is fine?

For example:
Name: <input type="text" id="text" name="fname">
Jul 19 '05 #1
2 1397
Hi,
name is fine

Jon

"Matt" <ma*******@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I want to know if we need id attribute? Or just name attribute is fine?

For example:
Name: <input type="text" id="text" name="fname">

Jul 19 '05 #2
Matt wrote:
I want to know if we need id attribute? Or just name attribute is
fine?

For example:
Name: <input type="text" id="text" name="fname">


This is a matter of personal preference unless:

1. the element is in a form which you are submitting to an asp page, in
which case the name attribute must be set in order for the receiving page to
read its value.
2. the element is part of a group of elements which you need to refer to
with a single identifier. In this case, you should use the name attribute
for the grouping name, leaving the id attribute to be used for a unique name
for each element in the group. Radio buttons and checkboxes are often
created this way.

Otherwise, it's really up to you. My personal preference is to use id to
uniquely identify a single element on a page, and name for form elements and
grouped elements. In script, I will always use the id to refer to a single
element.

This is an HTML/DHTML question and should have been asked in a more
appropriate group (look for a group with "DHTML" in its name, or one of the
..scripting groups depending on which language you wish to use in your
client-side script). ASP (server-side code) knows nothing about element
names or ids.

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3

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

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
0
by: Adam Wasi | last post by:
Hi all This is what I have in mind and I will appreciate any suggestions. I am trying to create a xml help system for my application. The schema of the xml file will be <helpsystem> <help...
1
by: CB | last post by:
I have a group of documents that previously had no schema, now I have a schema, and I want to use XSLT to fixup the documents by inserting the namespace reference. In other words, my input...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
1
by: comic_rage | last post by:
Hi, I am writing C# code to produce xml schema. //Create attribute XmlSchemaAttribute att2 = new XmlSchemaAttribute(); att2.Name = "CustomerID"; att2.SchemaTypeName = new...
1
by: sommarlov | last post by:
Hi everyone >From one of our systems an xml file is produced. I need to validate this file before we send it to an external system for a very lenghty process. I cannot change the xml file layout....
8
by: | last post by:
The problem lies here eval("document.TeeForm.amt.value(S+M)"); S and M suppose to add up and the total suppose to appear on the AMT field but it didn't. Any help? ...
2
by: Anders B | last post by:
I want to make a program that reads the content of a LUA array save file.. More precicely a save file from a World of Warcraft plugin called CharacterProfiler, which dumps alot of information about...
11
by: NewGuytoNetworking | last post by:
I have an XML that my company sends out daily it used to be created by SQL but I now have to use crystal reports and I can't seem to get it to line up the same. Please help with any references or how...
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...
0
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...
0
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,...
0
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.