<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>arguments</title>
<style type="text/css">
#div1{width:200px;height:200px;background:cyan;}
</style>
</head>
<body>
<script type="text/javascript">
function sum(){
var result=0;
var i=0;
for(i=0;i<arguments.length;i++){
result+=arguments[i]
}
document.write(result+"<br /><br />")
}
sum(1,1,3,5)
</script>
<script type="text/javascript">
function css(){
if(arguments.length==3){ //设置样式
arguments[0].style[arguments[1]]=arguments[2]
}else if(arguments.length==2){ //取值
arguments[0].currentStyle=arguments[1]
}
}
window.onload=function(){
var bt1=document.getElementById("bt1");
var div1=document.getElementById("div1");
bt1.onclick=function(){
//css(div1,"background","red");
alert(css(div1,"width"))
}
}
</script>
<input type="button" value="设置样式" id="bt1"/>
<div id="div1"></div>
</body>
</html>