473,626 Members | 3,947 Online
Bytes | Software Development & Data Engineering Community
+ 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 1408
Hi,
name is fine

Jon

"Matt" <ma*******@hotm ail.com> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
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
7860
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 allso subclassed the window and do see all kinds of WS_??? messages coming by. But now I'm stuck :-\ I've got *no* idea what to do next, and all my searching on the web leads me
0
753
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 id="unique id"> <text>text data</text> <link href="optional tag which will hold a reference to a uri"
1
2274
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 document looks like <SiteAdaptationFile> ... </SiteAdaptationFile>
6
6322
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, column 13: there is no attribute "SRC" <bgsound src="C:\My Documents\zingwent.mids"> You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is...
1
1626
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 XmlQualifiedName("int",schemaNS); att2.Use = XmlSchemaUse.Required; ct.Attributes.Add(att2);
1
1713
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. The solution i got today is very slow, and i need help to find another solution. Here is the xml file. It consists of a list of position ids (ESTOXX50 INDEX_BM_E and FTSE INDEX_BM_E), and below that a list of tags for each position id. What i...
8
3708
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? ============================ CODE ==============================================
2
1803
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 your characters into that save file. Anyhow, I want to extract a couple of lines of it and save it into a database and I need help on figuring out a good way of reading the file. The problem is that the file can look pretty different depending...
11
2899
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 to rewrite my schema. I will try to provide pictures of what currently have. (This is Mine from Crystal Reports) <?xml version="1.0" encoding="UTF-8" ?> - <BSASStockStatus xmlns="urn:crystal-reports:schemas"...
0
8266
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
8705
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
8638
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
8365
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
8505
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
5574
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.