1.javascript语句直接调用
2.在事件中调用
3.在超链接中调用
<html>
<head>
<title>
javascript demo
</title>
<script language="JavaScript" type="text/javascript">
function myfun()
{
alert("show alert,ok!");
form1.textBox1.value=eval(form1.textBox1.value)+eval(6);
}
function myfun2(){
document.write("hello ,use document to write content");
}
function myfun3(){
alert("call function in myfun3");
myfun();
}
myfun3();
</script>
</head>
<body>
<form name="form1" action="">
<input type="text" name="textBox1"value="1"></input>
<input type="button" value="click me" οnclick=myfun()>
<br>
<a href=javascript:myfun2()>call myfun2</a>
</form>
</body>
</html>