I'm trying to validate a web page so that it's xhtml strict. XHTML doesn't use the "Name" attribute in an IMG tag. Am I unable to declare a "name" attribute in an IMG tag?
Nope, no "name". But why on earth would you want to give an image a name anyway? And, more importantly, why are you bothering with XHTML? HTML 4.01 Strict is much better for most all applications.
hmm.. i'm working on a site and entering it into a content management system which requires the pages to be XHTML. as for the NAME attribute in the IMG tag, not sure what it's used for. I didn't write any of the HTML itsefl. This is what I have to work with.
this the IMG i'm reffering to
<img src="/images/tab_stu_e.gif" alt="Students" name="stutab" width="89" height="23" style="border-width: 0px" id="stutab" />
Just rid yourself of that troublesome "name" attriute.
The only tags that need names in XHTML are radio buttons. All other tags should use ids instead.
Well, that is true about the radios even if your form ain't submitting to anywhere.
But don't all your other INPUT fields within your FORM need NAMEs too in the case of forms submitting to somewhere? I'm no good with XHTML, so this is an actual question.
In XHTML 1.0 Strict META elements require "name" or "htp-equiv" attributes. The following elements can take "name" attributes: A, OBJECT, PARAM, MAP, INPUT, SELECT, TEXTAREA, BUTTON. In XHTML 1.0 transtional add the IMG element.
Wow, what a way to cover all the details! Thanks.
"i use xhtml and html, i just tend to use id (exept for in the meta tag) is there a problem with that(less professional or sumtin).
The "id" attribute is quite fine but some say it is better to use the "name" attribute with FORM controls. Don't get me started about XHTML.
You can use name or id with form controls. The only form controls where you have to use name are radio buttons.
From the HTML 4.01 Specification:
A control's "control name" is given by its [font=monospace]name[/font] attribute.
thx for all the help. i ended up just taking the name attribute out compeletely. it had no effect on the functionality of the page.
You can use name or id with form controls.
There are definitely situations where only using id will cause problems. I always use both because I never know when we'll have to go back and add validations.