1,放在<script></script>标签对之间。
<html>
<script language="javascript">
var x = 3;
</script>
<p>啊哈哈</p>
<script language="javascript">
alert(3);
</script>
</html>
alert(new Date());
<script src="hello.js" language="javascript">
</script>
3,将脚本代码作为属性值
<a href="javascript:alert(new Date());">javascript</a>