関数の引数に配列を利用
下のSampleのスタイルを変更します
下のSampleのスタイルを変更します
Sample Source......................................................................>>>
<script language="JavaScript"><!--
function Test1(colorArray){
document.getElementById("samp").style.color = colorArray[0];
document.getElementById("samp").style.backgroundColor = colorArray[1];
document.getElementById("samp").style.borderColor = colorArray[2];
document.getElementById("samp").style.borderWidth = colorArray[3];
}
//--></script>
</head>
<body>
<button onclick="Test1(['red','mistyrose','blue',3])">Style 1</button>
<button onclick="Test1(['blue','lavender','red',2])">Style
2</button>
<button onclick="Test1(['black','white','green',1])">Style
3</button>
<h5 id="samp">Sample</h5>