2 个解决方案
#1
可以转义楼主试试下面代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="div1"></div>
</body>
</html>
<script type="text/javascript">
window.onload=function(){
document.getElementById("div1").innerHTML = "aaa bbb" ;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="div1"></div>
</body>
</html>
<script type="text/javascript">
window.onload=function(){
document.getElementById("div1").innerHTML = "aaa bbb" ;
}
</script>
#2
document.getElementById("test").innerText = " " ;
#1
可以转义楼主试试下面代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="div1"></div>
</body>
</html>
<script type="text/javascript">
window.onload=function(){
document.getElementById("div1").innerHTML = "aaa bbb" ;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div id="div1"></div>
</body>
</html>
<script type="text/javascript">
window.onload=function(){
document.getElementById("div1").innerHTML = "aaa bbb" ;
}
</script>
#2
document.getElementById("test").innerText = " " ;