<html>
<head>
<title>jQuery 配列のループ $.each</title>
<script type="text/javascript" src="jquery-1.2.3.js"></script>
<script type="text/javascript">
<!--
function changeDiv() {
var arr = ["No1","No2","No3"];
$.each(arr,function(i) {
alert(i + "番目:" + this);
});
}
// -->
</script>
</head>
<body>
<input type="button" value="実行" onclick="javascript:changeDiv()">
</body>
</html>
|