ur.setAttribute("innerHTML","red");这个东西能运行吗
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
var main = document.body;
//创建链接
function createa()
{
    
        var ur = document.createElement("a");
        ur.setAttribute("href","http://www.imooc.com");
        ur.setAttribute("innerHTML","red");
        //ur.href="http://www.imooc.com";
        //ur.innerHTML="kjljl";
        ur.innerHTML = "red";
        this.main.appendChild(ur);
    
    
    
}
// 调用函数创建链接
    createa();
</script> 
</body>
</html>ur.setAttribute("innerHTML","red"); 这样写是设置ur下属性名为innerHTM的值为red,而不是你要显示的内容。