unshift

種類メソッド
書式 配列オブジェクト.unshift(追加要素,...,追加要素)
解説
先頭に配列要素を追加します。追加した要素の数だけ全体に要素が移動します。
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
form { position:absolute; top:10;left:10px; }
--></style>
<script type="text/javascript"><!--
window.onload = function()
{
myAry = new Array(12,34,"AB","CD");
myAry.unshift("XYZ");
document.getElementById("txtField").value = myAry;
}
// --></script>
</head>
<body>
<img src="Default.png">
<form>
<input type="text" id="txtField" size=40"><br>
</form>
</body>
</html>
実際のスクリプトをダウンロード