為啥我的代碼不能運(yùn)行???
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>無(wú)標(biāo)題文檔</title>
</head>
<body>
<script type="text/javascript">
var main = document.body;
//創(chuàng)建鏈接
function createa(url,text)
{var aURL=document.createElement("a");
?aURL.type="text";
?aURL.;
?main.appendChild(aURL);
? ??
}
// 調(diào)用函數(shù)創(chuàng)建鏈接
var button=document.createElement("input");
button.type="button";
button.value="點(diǎn)擊創(chuàng)建鏈接";
button.onclick="javascript:'createa(url,text)'";
main.appendChild(button);
</script>?
</body>
</html>
2017-03-03
既然把url和text作為參數(shù)傳進(jìn)去了,就要使用它們啊。更何況網(wǎng)址應(yīng)該是http://www.baidu.com
2017-03-03
正確答案是改為