太郁闷了,到底为什么啊?
代码是这样滴:
<%@ Page language= "c# " Codebehind= "WebForm1.aspx.cs " AutoEventWireup= "false " Inherits= "OnLine.WebForm1 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<html>
<head>
<title> WebForm1 </title>
<meta name= "GENERATOR " Content= "Microsoft Visual Studio .NET 7.1 ">
<meta name= "CODE_LANGUAGE " Content= "C# ">
<meta name=vs_defaultClientScript content= "JavaScript ">
<meta name=vs_targetSchema content= "http://schemas.microsoft.com/intellisense/ie5 ">
<script type= "text/javascript ">
function test()
{
var str = "组100 ";
document.getElementById( "div1 ").innerHTML = str;
}
function ShowCode()
{
alert(document.body.innerHTML);
}
</script>
</head>
<body>
<form id= "Form1 " method= "post " runat= "server ">
<div> <span id= "div1 "> 组1 </span> </div>
<div> <span id= "div2 "> 组2 </span> </div>
<input type= "button " value= "测试 " onclick= "test(); "/>
</form>
<input type= "button " value= "查看代码 " onclick= "ShowCode(); "/>
</body>
</html>
但为什么每次修改div1的文本后上面就多出一行呢??
------解决方案-------------------- 我复制到 记事本上,删掉第一行,该了后缀名为html,打开没问题啊
------解决方案--------------------那就是多了 <> 这种东西