chadmichael Posted January 5, 2006 Share Posted January 5, 2006 Hello,I've been working on an existing web site and have come across the use of the name attribute in such tags as <table> and <tr>. As far as I know, this isn't valid. Does it do anything at all? Under any circumstsances? Can I remove it safely? Thanks,Chad Link to comment Share on other sites More sharing options...
Skemcin Posted January 5, 2006 Share Posted January 5, 2006 It is very much valid but in XHTML 1.0 is being replaced with "id".It is VERY powerful as it identifies the element in a unique way - seperating it from just being another <table> or <tr>. Javascript uses the attribute most heavily.<table> vs. <table name="testscores">The second one allows me visually and programmatically single out that table from all the other <table> on the page. If each were assigned a name, then its easier to identify them. Think of it like naming your children - if you don't give the one, then how are you gonna tell them to shut up!! Link to comment Share on other sites More sharing options...
aspnetguy Posted January 5, 2006 Share Posted January 5, 2006 I am pretty sure it is no longer valid. The name attribute was probably used by JavaScript. Do you have javascript in this website???If you remove the name attributes the javascript will stop working...I suggest you change the name="" to id="" and in the javascript reference them using document.getElementById.If you need some help with that just post your questions and code. Link to comment Share on other sites More sharing options...
aspnetguy Posted January 5, 2006 Share Posted January 5, 2006 Think of it like naming your children - if you don't give the one, then how are you gonna tell them to shut up!!lol nice...sorry about the double post...we posted at he same time. Link to comment Share on other sites More sharing options...
chadmichael Posted January 5, 2006 Author Share Posted January 5, 2006 So . . . the id attribute is the preferred way of doing things nowadays? Link to comment Share on other sites More sharing options...
F-Man Posted January 5, 2006 Share Posted January 5, 2006 Yes.The name attribute is for: input, select, textarea, object (you should still use id though), meta and param. The rest uses unique ids. Link to comment Share on other sites More sharing options...
Skemcin Posted January 5, 2006 Share Posted January 5, 2006 lol nice...sorry about the double post...we posted at he same time. lol - no worries Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now