回到日志首页发送邮件给 i@amiku.cn直接在网站上留个言
当前位置: 阿米酷 | amiku.cn » 编程设计(实践和教程) » 文章正文

HTML中name和id的用处区别

时间: 2004-06-08 / 分类: 编程设计(实践和教程) / 浏览次数: 人气指数:465 / 2个评论 发表评论

——————————————————————————–
name用于以下元素:

1. window

2. frame

3. A, APPLET, attribute, BUTTON, EMBED, FORM, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, MAP, OBJECT, RT, RUBY, SELECT, TEXTAREA

——————————————————————————–
id可用的元素就多了:

STYLE, A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BDO, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, hn, HR, , I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, nextID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, RT, RUBY, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, styleSheet, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, WBR, XML, XMP

—————————————————————————————
- name我们一般不用来作为元素的标识的,而是做为两大用途:
1.window、frame、a 的name用来做链接的target。
2.input等的表单元素的name用来在submit时和value的数据绑定提交的。

id则用来做元素的标识。

2个评论

  1. NiltdalpTal
    2010/12/24 03:08:01

    Good Luck

    http://www.call2run.com – My Blog

    回复

  2. Nixteenuepdut
    2010/12/16 22:38:50

    Yo Guys! [url=

    http://www.myloans.comimghttp://loansdiy.com/images/autoinsurance.gif

    [/img][/url]

    I’m doing research online [url=http://loansdiy.com/category/home-loans/] Home Loans[/url]

    info to get loans info for my family.

    Hope if anyone will give me some suggestions on

    [url=http://loansdiy.com/category/home-loans]Home Loans[/url] Blogs. Thanks alot!

    回复

发表评论

您的昵称 *

您的邮箱 *

您的网站