用js实现在加载完成一个页面后自动执行一个方法

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
 
<title>Document</title> <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/hestyle.css"> <script type="text/javascript" src="${pageContext.request.contextPath}/js/hecoyote.js"></script> <!-- 执行的方法 --> <script type="text/javascript"> function myfun(){ window.location.href="${pageContext.request.contextPath}/suntrayResumePush/dataLists.do"; } </script> </head> <!--onload="myfun()" 调用要执行的方法 --> <body onload="myfun()"> </body> </html>

 

posted @ 2016-07-04 13:30  Smile_灰太狼  阅读(10949)  评论(0)    收藏  举报