<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>無標(biāo)題文檔</title>
</head>
<body>
<script?type="text/javascript">
var?main?=?document.body;
//創(chuàng)建鏈接
function?createa(url,text)
{
????var?test?=?document.createElement("a");???????
????test.setAttribute("href",?"url");
????test.innerHTML=text;
????test.style.color="red";
????main.appendChild(test);
}
//?調(diào)用函數(shù)創(chuàng)建鏈接
createa("http://www.qq.com","騰訊網(wǎng)");
</script>?
<br/>
<input?type="button"?value="創(chuàng)建鏈接"?onclick="createa("http://www.baidu.com","百度")"/>
</body>
</html>
請(qǐng)問點(diǎn)擊按鈕怎么不能創(chuàng)建鏈接?
jzman
2015-10-20 16:38:31