Forum Moderators: open

Message Too Old, No Replies

why is dreamweaver adding an "id" attribute to my anchors?

         

suzanne

6:24 pm on Sep 17, 2003 (gmt 0)

10+ Year Member



Hiya... got a 101 question for you experts out there...

I am fairly familiar with oldstyle html, and have an introductory understanding of CSS. When I use dreamweaver WSWYG editor, why does it insert the "id" attribute to my anchors? If I am only using this as an anchor, is this necessary, and/or how can I use it to my advantage.

jeremy goodrich

8:52 pm on Sep 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"id" is for adding CSS stuff to the element (I think).

For a plain old anchor, the ID isn't necessary.

Lobelas

9:20 pm on Sep 17, 2003 (gmt 0)

10+ Year Member



I think that in future versions of XHTML the name attribute will be replaced by the id attribute, so maybe that has something to do with it. I'm not that familiar with Dreamweaver though.

jeremy goodrich

9:21 pm on Sep 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In my default at work on Dreamweaver 4.0, it doesn't insert the ID automatically, nor does it at home (using dreamweaver MX) - however, I create docs that are HTML 4x instead of XHTML 1.0, which might be the reason for the automatic ID attribute, as mentioned above.

MonkeeSage

12:03 am on Sep 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To recapitulate:

Currently in XHTML / DOM2, the

name
and
id
attributes share the same namespace in the DOM.

CSS selectors that start with the pound / sharp sign ("#") specify elements with

id
attributes (e.g., #red specifies the element that has id="red").

Plus I can think of another reason,

You may have generated menus or anything with script, DW may be using the

id
attributes for JavaScript DOM methods, the most common of which is
document.getElementById("red");
(where the element you want to get the object for has id="red").

Jordan