<!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>
解决方案 »
- extjs 加载数据
- 有没有比较好用的,功能强大的js treeview组件,大家谁有,给介绍一下。。。
- 问一个event的问题
- javascript操作DOM导致浏览器产生回流操作
- JS怎么样才能动态的改变行的背景色
- 求助,这个功能怎么在javascript中实现?
- 怎样用javascript中弹出一个文件选择的对话框?
- 用javascript css来实现3级层叠式菜单
- 百分求http://www.flashempire.com/school/tutor.php 右边那QQ广告的源码,谢谢!
- 我在页面上显示一个层,怎样可以在用户点击层之外的区域时,将其隐藏。
- 求助:鼠标放在单元格里的文字链接上时如何改变单元格背景图,离开时又恢复原来背景图
- 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>