这么混着用算不规范吗?
<script type="text/javascript">
var main = document.body;
//创建链接
function createa(url,text)
{
var link = document.createElement("a");
link.setAttribute("href",url);
link.innerHTML = text;
link.style.color = "red";
main.appendChild(link);
}
createa("http://www.imooc.com","慕课网");// 调用函数创建链接
</script>