# 小試身手
還記得jQuery如何使用的么?Sea.js也是如此。例子在[這里](https://github.com/Bodule/HelloSea.js/blob/master/getting-started)可以找到,用[anywhere](https://github.com/JacksonTian/anywhere)起個靜態服務來看看。
## 首先寫個模塊:
~~~
// File:js/module/greet.js
define(function (require, exports) {
function helloPython() {
document.write("Hello,Python");
}
function helloJavaScript() {
document.write("Hello,JavaScript");
}
exports.helloPython = helloPython;
exports.helloJavaScript = helloJavaScript;
});
~~~
如果你對Node.js非常熟悉,你可以把這個模塊理解為Node.js的模塊加上一個Wrapper。
## 在頁面中引入Sea.js:
~~~
<!-- File:index.html -->
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Getting start with Sea.js</title>
<!-- 引入seajs-->
<script src="/js/sea.js"></script>
</head>
<body>
</body>
</html>
~~~
## 加載模塊文件!
~~~
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Getting start width Sea.js</title>
<!-- 引入seajs-->
<script src="/js/sea.js"></script>
<script>
seajs.use(['/js/module/greet'], function (Greet) {
Greet.helloJavaScript()
})
</script>
</head>
<body>
</body>
</html>
~~~
看到頁面上輸出的`Hello,JavaScript`么,這確實太簡單了!