现在关键是打开网页,js代码没有反应??????????????
<!DOCTYPE html >
<html >
<head>
<meta charset=utf-8 />
<script type="text/javascript" src="text.js"></script>
</head>
<body>
<p>123</p>
<h3>aaa</h3>
</body>
</html>
下面是对应的JavaScript代码........................................................................................................
function xx()
{
document.write("sss");
document.getElementByTagName("p").write("qqq");
document.getElementByTagName("p").innerHTML("www");
}
window.onload(xx);
你这个错误也太多了
1, window.onload = xx;
2, document.getElementsByTagName
3, innerHTML = 'www';
4, 只有document.write,其它dom节点没有这个方法
劝楼主还是多看看dom api
哈哈哈,吐槽不能...
function xx(){
document.getElementsByTagName('p')[0].innerHTML = 'www';
document.write('sss')
}
window.onload = xx;