您的位置:首页 > Web前端 > JavaScript

JS类的封装及实现代码(静态)

2014-10-14 11:10 393 查看
1) student.js

function student() { }
student.add_student = function () {
alert('add student!');
}
student.get_student = function () {
alert('get student!');
}2) Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="js/student.js"></script>
<script type="text/javascript">
window.onload = function () {
student.add_student();
student.get_student();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  js 面向对象 封装