HTML代码由标记(tag)和文本(text)组成。标记是HTML的基本单位,它用于描述网页的结构和内容。标记通常由尖括号()包围,例如:
ll>标记包含了整个网页的内容,和标记包含了网页的头部信息,
HTML标记的语法
HTML标记通常由标记名和属性组成,例如:
ameame>
ame是标记的名称,attribute1和attribute2是标记的属性,value1和value2是属性的值,text是标记的文本内容。
常用的HTML标记包括:
l>:定义HTML文档
-:定义文档头部
–
-:定义文档主体
–
~:定义标题
–
:定义段落
解析HTML代码的方法
ent Object Model)树,从而方便地对网页进行操作和修改。
ent对象来访问DOM树,例如:
// 获取文档标题ent.title;
// 修改文档标题ent.title = “新标题”;
// 获取元素entententByIdent_id”);
// 修改元素内容entnerHTML = “新内容”;
ent对象来访问DOM树,从而方便地对网页进行操作和修改。