有关
的问题!

Yjanuary 2004-01-20 09:09:33
小弟初学asp,见到许多人编程的时候都爱用div把一大段程序包起来,
可是我去掉div了,感觉好象没有什么区别啊?
求教高手,<div>什么时候要用,什么时候可用可不用??
谢了!
...全文
59 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2004-01-20
  • 打赏
  • 举报
回复
DIV

--------------------------------------------------------------------------------

Description

The DIV element is used to represent different kinds of containers in a document such as chapter, section, abstract, appendix, etc.

Syntax
<DIV
ALIGN=CENTER | LEFT | RIGHT
CLASS=classname
DATAFLD=colname
DATAFORMATAS=HTML | TEXT
DATASRC=#ID
ID=value
LANG=language
LANGUAGE=JAVASCRIPT | JSCRIPT | VBSCRIPT | VBS
STYLE=css1-properties
TITLE=text

event = script
>



Parameter Description
ALIGN=CENTER | LEFT | RIGHT Displays the element left flush, right flush, or centered relative to the display or table.
CLASS=classname Specifies the class of the tag being defined. This is used to associate a sub-classed style sheet with the tag.
DATAFLD=colname The column name from the data source object that supplies the bound data.
DATAFORMATAS=HTML | TEXT Indicates whether bound data is plain text or HTML.
DATASRC=#ID Indicates the ID of the data source object that supplies the data that is bound to this element.
ID=value An SGML identifier used as the target for hypertext links or for naming particular elements in associated style sheets. Valid ID values must begin with a letter. The underbar character, "_", may be used in the ID name. The ID should be unique throughout the scope of the document. If more than one object with the same identifier exists in a document, a collection of those named items is created that can only be referenced by ordinal position.
LANG=language Specifies which language to use in ISO standard language abbreviation form.
LANGUAGE=JAVASCRIPT | JSCRIPT | VBS | VBSCRIPT Specifies the language the current script is written in and invokes the proper scripting engine. The default value is JAVASCRIPT. JAVASCRIPT, JSCRIPT The scripting language is written in JavaScript.
VBS, VBSCRIPT The scripting language is written in VBScript.

STYLE=css1-properties Specifies an in-line style sheet for the tag.
TITLE=text Used to provide advisory information. The contents of the title attribute will be displayed in a ToolTip during the onmouseover event.
event Can be one or more of these events: onafterupdate onbeforeupdate
onblur onclick
ondblclick ondragstart
onfocus onhelp
onkeydown onkeypress
onkeyup onmousedown
onmousemove onmouseout
onmouseover onmouseup
onresize onrowenter
onrowexit onscroll
onselectstart


Remarks

This element is a block element.

Both the start and end tags are required.

Example

<DIV>
This text represents a section.
</DIV>

<DIV ALIGN=CENTER>
This text represents another section, and its text is centered.
</DIV>

超级大笨狼 2004-01-20
  • 打赏
  • 举报
回复
这些东西恐怕是<br>无法代替的
DIV

Description

Specifies a container that renders HTML.

Remarks

This element is a block element.

Properties

align, className, clientHeight, clientWidth, dataFld, dataFormatAs, dataSrc, document, id, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerText, parentElement, parentTextEdit, scrollHeight, scrollLeft, scrollTop, scrollWidth, sourceIndex, style, tagName, title

Methods

blur, click, contains, focus, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView, setAttribute

Collections

all, children, filters

Events

onafterupdate, onbeforeupdate, onblur, onclick, ondblclick, ondragstart, onfocus, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onresize, onrowenter, onrowexit, onscroll, onselectstart

nbchp 2004-01-20
  • 打赏
  • 举报
回复
DIV是层!
能少用尽量少用!
mikespook 2004-01-20
  • 打赏
  • 举报
回复
http://www.xxiyy.com/msg/index.php?id=6

你看看我的留言和头像选择~~~就是用div做的~~
angel2a 2004-01-20
  • 打赏
  • 举报
回复
<div>和<br>差不多?!头一次听说
估计你看到老包起来可能是需要将页面居中或什么的
<div>是层,你慢慢看看他的相关资料就会晓得的

当然没必要不用把页面用<div>包住
ChinaLights 2004-01-20
  • 打赏
  • 举报
回复
<div>在HTML中的作用和<br>差不多,比如:
大家新年快乐,万事如意。这段语句会以一行显示,如果代码写成这样
大家新年快乐,<div>万事如意。</div>那结果显示出来会是这样.

大家新年快乐,
万事如意。
分成两行显示,同时<div>有时在用到CSS或是触发事件时很有用场

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧