window.onload()

<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
	<head>
		<base href="<%=basePath%>">
		<title>测试</title>
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>
	<script type="text/javascript">
  function show(){
  alert("你点击的是按钮!");
  }
  window.onload=function(){//加载时绑定函数,显示信息
  document.getElementById("btn").onclick=show;
  }
  </script>
	<body>


		<input id="btn" type="button" value="测试" />
	</body>
</html>

 

你可能感兴趣的:(JavaScript,java,html,css)