Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 1006 Bytes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Javelin Example: Win a Hog</title>
<script src="../pkg/init.min.js" type="text/javascript"></script>
</head>
<body>
<p>This is a simple page demoing Javelin behaviors.</p>
</body>
<script src="../pkg/javelin.min.js" type="text/javascript"></script>
<script type="text/javascript">
JX.behavior('win-a-hog', function(config, statics) {
statics.hogsWon = (statics.hogsWon || 0) + 1;
if (statics.hogsWon == 1) {
alert("YOU WON A HOG! YOUR HOG IS NAMED " + config.hogName + "!");
} else {
alert("YOU WON ANOTHER HOG!!! " +
"THIS ONE IS NAMED " + config.hogName + "!");
}
});
JX.Stratcom.mergeData(0, {});
JX.initBehaviors({
'win-a-hog' : [{hogName : "Ethel"}, {hogName : "Beatrice"}],
});
</script>
</html>