<!DOCTYPE html>
<html>
<head>
<title>javascript01.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
window.onload = init;
console.log('测试方法的调用');
f1();
function f1(){
console.log('f1');
}
var f2 = function(){
console.log('f2');
}
f2();
console.log('简单事件');
with(document){
write('aaa<br/>');
write('bbb<br/>');
write('ccc<br/>');
}
function fn1(obj){
console.log(obj);
console.log(obj.innerHTML);
}
function fn2(obj){
obj.style.color = '#f00';
obj.style.fontSize = '25px';
}
function fn3(obj){
obj.style.color = '#000';
obj.style.fontSize = '12px';
}
function init() {
document.getElementById("clickMe").style.color="#f00";
}
</script>
</head>
<body>
<span onclick="fn1(this)">click me</span><br/>
<span onmouseover="fn2(this)" onmouseout="fn3(this)">鼠标移上去试试</span><br>
<span id="clickMe">页面加载完执行</span>
</body>
</html>