<!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=gb2312" />
<link rel="stylesheet" href="css/PublicStyle.css" type="text/css" />
<link rel="stylesheet" href="css/WorkAreaStyle.css" type="text/css" />
<title>无标题文档 </title>
</head><body><input id="xxx" type="hidden" value="" />
<input id="btn" type="button" value="test hd" onclick="test(1);" /> <!--主动调用-->
<div id="cccccc">11111111111</div>
</body>
<script language="javascript" type="text/javascript">function changeColor( color ) {
//alert(color)
this.style.color = color;
}function setBodyColor() {
//apply方法设置上下文为body元素
//第一个参数为设置的上下文,
//第二个参数是一个被作为参数传递给函数的数组
// of arguments that gets passed to the function
changeColor.call( document.getElementById("cccccc"), arguments[0][0] );
}
setBodyColor(['red','blue'])
</script>
</html>
解决方案 »
- jquey jajx返回值data是个数组,如何取值。
- jquery easyui 里 treegrid 支持动态加载吗?
- Math.random()纠结
- obj.disabled=false IE6下无效
- 关于ownerDocument.defaultView.getComputedStyle
- form1为空或不是对象!急,急!
- 如何实现新闻标题在中文数为30、60、90...等处换行
- 用JS修改注册表 使IE降级后,控件是可以运行了 但是这样不行 不知是什么原因?
- js操作lrc歌词,播放器用flash
- html页面如何获得js函数返还值?
- 求助:鼠标放在单元格里的文字链接上时如何改变单元格背景图,离开时又恢复原来背景图
- arguments?
)应该不对了,因为arguments是数组,那这里(function changeColor( color ) {
//alert(color)
this.style.color = color;
}
)color也是数组了!
<!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=gb2312" />
<link rel="stylesheet" href="css/PublicStyle.css" type="text/css" />
<link rel="stylesheet" href="css/WorkAreaStyle.css" type="text/css" />
<title>无标题文档 </title>
</head><body><input id="xxx" type="hidden" value="" />
<input id="btn" type="button" value="test hd" onclick="test(1);" /> <!--主动调用-->
<div id="cccccc">11111111111</div>
</body>
<script language="javascript" type="text/javascript">function changeColor( color ) {
//alert(color)
this.style.color = color;
}function setBodyColor() {
//apply方法设置上下文为body元素
//第一个参数为设置的上下文,
//第二个参数是一个被作为参数传递给函数的数组
// of arguments that gets passed to the function
changeColor.apply(document.getElementById("cccccc"),arguments);
}
setBodyColor('red','blue')
</script>
</html>