在DIV的innerHTML是javascript脚本,怎么自动运行??

[复制链接]
查看11 | 回复1 | 2009-11-26 12:33:25 | 显示全部楼层 |阅读模式
在最后加一句:eval(参数是你得到的字符串);
回复

使用道具 举报

千问 | 2009-11-26 12:33:25 | 显示全部楼层
insertAdjacentHTML(where,html) html形式插入where有四种 beforeBegin,afterBegin,beforeEnd,afterEnd例: 将会在div中插入变量X的内容。insertAdjacentText(where,text)text 形式插入例 :var
x = "hello this is xiaomei test";
insert2.insertAdjacentText("afterBegin", x );insertAdjacentElement(where,element) 以表单元素的形式插入,表单元素可以由document.createElement("")创建例 :var s=document.createElement("");s.value = 'hello world';insert3.insertAdjacentElement("afterbegin",s);添加HTML内容与文本内容以前用的是innerHTML与innerText方法,最近发现还有insertAdjacentHTML和insertAdjacentText方法,这两个方法更灵活,可以在指定的地方插入html内容和文本内容。insertAdjacentHTML方法:在指定的地方插入html标签语句原型:insertAdajcentHTML(swhere,stext)参数:swhere: 指定插入html标签语句的地方,有四种值可用:1.
beforeBegin: 插入到标签开始前2.
afterBegin:插入到标签开始标记之后3.
beforeEnd:插入到标签结束标记前4.
afterEnd:插入到标签结束标记后stext:要插入的内容


************************************************************************************wwwwwwww*************************************************************************************
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行