动态添加控件:document.all.add_line.InsertAdjacentHTML,这句是什么意思呀?

qing7911 2005-11-03 09:33:52
大虾帮我详解下
...全文
108 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dh20156 2005-11-03
  • 打赏
  • 举报
回复
看看这个DHTML手册的参考:
<body>
<div id="ScriptDiv"></div>
<script language="javascript">
var sHTML="<input type=button onclick=go2() value='Click Me'><BR>"
var sScript='<SCRIPT DEFER>function go2(){ alert("Hello from inserted script.") }</script' + '>';
ScriptDiv.insertAdjacentHTML("afterBegin",sHTML + sScript);
</script>
</body>
028city 2005-11-03
  • 打赏
  • 举报
回复
大概就是将一段HTML插入一个Object中
插入的位置由第一个参数确定,必须是后面的值,beforeBegin,afterBegin,beforeEnd,afterEnd
插入的内容由第二个参数确定
qing7911 2005-11-03
  • 打赏
  • 举报
回复
我原本是一团云的,看了大哥你的解释后就变两团云。。我金山快译还没装,可不可以给中文的解释呀?不用那么详尽的,介绍下就是了
028city 2005-11-03
  • 打赏
  • 举报
回复
Inserts the given HTML text into the element at the location.

Syntax

object.insertAdjacentHTML(sWhere, sText)
Parameters

sWhere Required. String that specifies where to insert the HTML text, using one of the following values:
beforeBegin Inserts sText immediately before the object.
afterBegin Inserts sText after the start of the object but before all other content in the object.
beforeEnd Inserts sText immediately before the end of the object but after all other content in the object.
afterEnd Inserts sText immediately after the end of the object.

sText Required. String that specifies the HTML text to insert. The string can be a combination of text and HTML tags. This must be well-formed, valid HTML or this method will fail.

Return Value

No return value.

28,406

社区成员

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

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