解决方案 »
- JS修改CSS样式
- 求教:图片随机播放代码
- 离奇的if语句,js登陆验证问题
- 请问javascript如何取到HTML中<object>内元素的值?
- 这段代码在傲游里怎么不是弹出固定大小窗口啊?
- 关于jquery.treeview问题
- 请问怎么用datasrc填充select的option呀?
- 向Myeclipse添加现有项目提示The following projects must be upgraded to work correctly with
- 如何让window.open打开的窗口位于顶端?
- 如何用javascript语句实现相当于button点击?
- easui datagrid在没有请求到数据时怎么设置?
- 怎么用html的div或者JS,或jquery做一个类似于excel冻结窗格的效果,求救啊
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function returnColor() {
var str = "#";
var arr = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
for (var i = 0; i < 6; i++)
{
str =str + arr[Math.floor(Math.random() * 16 + 1)];
}
str = str + "";
alert(str);
document.body.style.backgroundColor=str;
};
window.onload=returnColor;
</script>
</head><body>
111
</body>
</html>
var str = "#";
for (var i = 0; i < 6; i++)
{
str += Math.floor(Math.random() * 16 + 1).toString(16);
}
alert(str);
$("#b1").css({ "background-color": str });
};
转义过后就等同于$("#b1").css({ "background-color": "\"#FFF\"" });显然这是不对的