Skip to content

Instantly share code, notes, and snippets.

@tbsmcd
Last active December 28, 2015 20:59
Show Gist options
  • Save tbsmcd/7561160 to your computer and use it in GitHub Desktop.
Save tbsmcd/7561160 to your computer and use it in GitHub Desktop.
<html>
<head></head>
<body>
<div id="image"></div>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script id="tmpl" type="text/x-jquery-tmpl">
<div class="photo">
<image src="http://www1.nhk.or.jp/kouhaku/images/countdown/pose_${number}.png">
</div>
</script>
<script>
var toDoble = function (num) {
str = String(num);
if (str.length === 1) {
str = '0' + str;
}
return str;
}
var data = [];
for (i=1;i<=21;i++) {
str = toDoble(i);
data.push({number:'l_' + str});
if (i<21) {
data.push({number:'r_' + str});
}
}
$('#tmpl').tmpl(data).appendTo('#image');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment