这个地方应该是yy.innerHTML。
outerHTML是改变包括yy在内的HTML标签。innerHTML改变内部。OK?
outerHTML是改变包括yy在内的HTML标签。innerHTML改变内部。OK?
解决方案 »
- 关于jquery多个bind事件的处理
- 火狐和chome都用类似onpropertychange的回调要怎么做?
- div onblur tabindex 同用,为什么会出现虚线?如何解决?求教!
- 如下的javascript中的cookie存放在winxp的哪里 在documents and settings中没有找到。
- 菜鸟请教:Dreamweaver与sql server2000怎样连接?
- 表格中固定行列
- javascript:如何在一个fro循环中实现暂停?
- 帮忙!很简单的问题
- 请问在页面按BackSpace键会返回上一页。这一个问题产生的规律和原因是什么,谢谢
- ????怎样在网页中链接exe文件,并且可以执行!!!
- 招聘专职开发工程师
- 请问如何设置某个具有特定id的<tr>元素的背景色?在线等!
什么innerHTML、outerHTML、insertAdjacentHTML
我全试过了!
我保证本问题堪称年度最难问题!!
s+= '<script>bb.innerText="xxx" function ff(){return "ff"}<'+'/script>'
==〉
s+= '<scr'+'ipt>bb.innerText="xxx" function ff(){return "ff"}<'+'/script>'tyr again
即使是这个样子:
s="<div id=bb>aa</div>"
s+="<style>#bb{font:19pt}</style>"
css也没有起作用!
我想实现网页的加载,也就是实现类似asp的<include>元素。
明白?看一下我的程序吧
http://expert.csdn.net/Expert/topic/1608/1608337.xml?temp=.7844507xinyunyishui(心云意水):
没准是版本问题,我的是ie6 sp1
<div id=xx>
<div id=yy>
<div id=aa>aa</div>
<script>aa.innerText='xx'</script>
</div>
</div>
<script>
alert(xx.innerHTML)
s="<div id=bb>aa</div>"
a="<style>#bb{font:19pt;color:red}</style>"//还有这里,应该是在head里面的,所以用document.write
a+= "<s"+"cript>bb.innerText='xxx';function ff(){return 'ff'}</"+"script>"//这里错了
alert(s)
yy.outerHTML=s
document.write(a)
alert(bb.outerHTML)
alert(ff())
</script>
</body>
http://expert.csdn.net/Expert/topic/1556/1556452.xml?temp=4.911441E-02
看来<div>里面不能嵌套CSS和SCRIPT了?
可是手工添加怎么就可以?看来我想实现加载,还得将脚本和CSS过滤出来,单独拿document.write写进去?
上面
s="<div id=bb>aa</div>"
s+="<style>#bb{font:19pt;color:red}</style>"//还是可以的
再说,过滤也是个很麻烦的事,非常麻烦!
代码如下:
---------------------------------------------<div id=xx>
<div id=yy>
<div id=aa>aa</div>
<style>#aa {font:14pt}</style>
<script defer>aa.innerText='xx'</script>
</div>
</div>
<script>
alert(xx.innerHTML)
s="<div id=bb>aa</div>"
s+="<style>#bb{font:19pt}</style>"
s+= '<script defer>bb.innerText="xxx";function ff(){return "ff"}<'+'/script>'
alert(s)
yy.outerHTML=s
alert(xx.innerHTML)
alert(ff())
</script>
<div id=xx>
<div id=yy>
<div id=aa>aa</div>
<script>aa.innerText='xx'</script>
</div>
</div>
<script>
alert(xx.innerHTML)
s="<div id=bb>aa</div>"
s+="<style>#bb{font:9pt;color:red}</style>"
a= "<s"+"cript>bb.innerText='xxx';function ff(){return 'ff'}</"+"script>"
yy.outerHTML=s
document.write(a)
alert(ff())
</script>
</body>
alert(xx.innerHTML)
s="<div id=bb>aa</div>"
s+="<style>#bb{font:9pt;color:red}</style>"
s+= "<script defer>bb.innerText='xxx';function ff(){return 'ff'}</"+"script>"
yy.outerHTML=s
alert(ff())
</script>
Indicates the script block contains only functions and no in-line script. Deferring the parsing of scripts until they are needed can improve performance by decreasing the time it takes to load a document.
又学了一招!
不过能否不限制客户端的使用,而在加载端进行处理?
假如用户程序里有
<script>
s='<style></style>'
</script>
??
我想实现网页的加载,也就是实现类似asp的<include>元素。
看一下我的程序吧
http://expert.csdn.net/Expert/topic/1608/1608337.xml?temp=.7844507
运行时添加css可以通过<STYLE>
BODY {background-color: #CFCFCF;}
@import url("otherStyleSheet.css");
</STYLE>
<SCRIPT>
window.onload=fnInit;
function fnInit(){
// Access a rule in the styleSheet, change backgroundColor to blue.
var oStyleSheet=document.styleSheets[0];
var oRule=oStyleSheet.rules[0];
oRule.style.backgroundColor="#0000FF";
// Add a rule for P elements to have yellow backgrounds.
oStyleSheet.addRule("P","background-color: #FFFF00;");
// Change and imported rule:
oStyleSheet.imports[0].color="#000000";
}
</SCRIPT>
感谢xinyunyishui(心云意水)、fason(阿信)、 ssm1226(雨中人) 、yonghengdizhen(生命过去了四分之一个世纪,我依然是我) 提出了非常好的方法。也感谢其他人的支持参与。
梅花雨大哥好像看不起我,我提的两个问题请梅花雨回答,都不理我!!!! 让帖子再呆几天吧,我想再看看还有没有高人的高见。
以前因为window.open会异步执行,而做过同步加载网页
也面临这样的问题。解决办法,以上阐述过了,只有defer或execScript最终采用的是execScript,因为没有(inline script的js是很少的)
execScript可以确保正确
http://www.solarstones.com/wzq/
我第一次写的,帮我测试一下好吗?
<style>
A.banner:link { COLOR: #ffff77; TEXT-DECORATION: none}
A.banner:visited { COLOR: #ffff99; TEXT-DECORATION: none}
A.banner:active { COLOR: #ffff77; TEXT-DECORATION: none}
A.banner:hover { COLOR: #ffffff; TEXT-DECORATION: none;background-color:#6090ff}
td.Menu_MItem1 {padding:3;border:solid 1px #f4faff;border-right:none;font:9pt;cursor:hand;white-space:nowrap}
td.Menu_MItem2 {padding:3;border:solid 1px #f4faff;border-left:none;font:9pt;cursor:hand}
td.Menu_MItem1o {padding:3;border:solid 1px #6060a0;border-right:none;background-color:#ffdd88;font:9pt;cursor:hand;white-space:nowrap}
td.Menu_MItem2o {padding:3;border:solid 1px #6060a0;border-left:none;background-color:#ffdd88;font:9pt;cursor:hand}
div.Menu_MPanel {POSITION:absolute;border:outset 1px #8080ff;}
div.Menu_MPanel2{background-color:#f4faff;border-left:solid 8px #8080ff;padding:2}
.Menu_MInner {}
</style>