可以说我有一个这样的网页:使用JavaScript删除最后一个HTML元素
<html>
<head>
<script>
//code that deletes the last element
</script>
</head>
<body>
<h1>nothing important in the body</h1>
</body>
</html>
<!-- and then there is another script element that I want to remove with javascript: -->
<script type="text/javascript" src="example.com"></script>
怎么能使用javascript我删除最后一个脚本元素?
只是好奇...该文件如何在文档结束后结束? – Touffy
我决定在某天使用免费的虚拟主机,并将其加载到弹出的广告代码中。我没有发现任何服务条款,说我不能尝试删除代码 – Mashpoe
我怀疑它可能是这种情况。正如我在更新后的答案中所写的,您将无法阻止脚本的执行。你必须让它发生,然后删除损坏(不是脚本,但它会添加到您的网页的废话)。 – Touffy