<script language=javascript>
function get_cookie(name_to_get) {
var cookie_pair
var cookie_name
var cookie_value
var cookie_array = document.cookie.split("; ")
// Run through the cookies
for (counter = 0; counter < cookie_array.length; counter++) {
// Split the cookie into a name/value pair
cookie_pair = cookie_array[counter].split("=")
cookie_name = cookie_pair[0]
cookie_value = cookie_pair[1]
// Compare the name with the name we want
if (cookie_name == name_to_get) {
// If this is the one, return the value
return unescape(cookie_value)
}
}
// If the cookie doesn't exist, return null
return null
}
// Get the bgColor cookie
var bg_color = get_cookie("bgColor_cookie")
// Did the cookie exist?
//if (bg_color) {
// document.bgColor = bg_color
//}
function set_color(color_val) {
// Get the currently selected color
//var color_list = color_form.color_name
//var selected_color = color_list.options[color_list.selectedIndex].value
// Change the color of the background
//opener.document["bgColor"] = color_val
// Save it in a cookie
set_cookie("bgColor_cookie", color_val, 365, "/")
}
function set_cookie(cookie_name, cookie_value, cookie_expire, cookie_path, cookie_domain, cookie_secure) {
// Begin the cookie parameter string
var cookie_string = cookie_name + "=" + cookie_value
// Add the expiration date, if it was specified
if (cookie_expire) {
var expire_date = new Date()
var ms_from_now = cookie_expire * 24 * 60 * 60 * 1000
expire_date.setTime(expire_date.getTime() + ms_from_now)
var expire_string = expire_date.toGMTString()
cookie_string += "; expires=" + expire_string
}
// Add the path, if it was specified
if (cookie_path) {
cookie_string += "; path=" + cookie_path
}
// Add the domain, if it was specified
if (cookie_domain) {
cookie_string += "; domain=" + cookie_domain
}
// Add the secure Boolean, if it's true
if (cookie_secure) {
cookie_string += "; true"
}
// Set the cookie
document.cookie = cookie_string
}
if (bg_color) {
bb1.style.backgroundColor = bg_color
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#a9a9a9,endColorStr=#ffffff)" ><form id="bb1">
<div align="left">
<tr>
<td width="281"><div align="left">
<table border="1" width="240" cellspacing="0" cellpadding="1" height="12" id="table1" style="border-collapse: collapse" bordercolor="#000000">
<tr>
<td onClick="bb1.style.backgroundColor='ffffff';set_color('ffffff')" bgcolor="#ffffff" width="50"></td>
<td onClick="bb1.style.backgroundColor='E8FFF3';set_color('E8FFF3')" bgcolor="#E8FFF3" width="50"></td>
<td onClick="bb1.style.backgroundColor='F1E8FF';set_color('F1E8FF')" bgcolor="#F1E8FF" width="50"></td>
<td onClick="bb1.style.backgroundColor='B4E7D9';set_color('B4E7D9')" bgcolor="#B4E7D9" width="50"></td>
<td onClick="bb1.style.backgroundColor='CDCDDE';set_color('CDCDDE')" bgcolor="#CDCDDE" width="50"></td>
<td onClick="bb1.style.backgroundColor='00bfff';set_color('00bfff')" bgcolor="#00bfff" width="50"></td>
<td onClick="bb1.style.backgroundColor='6495ed';set_color('6495ed')" bgcolor="#6495ed" width="50"></td>
<td onClick="bb1.style.backgroundColor='ffdab9';set_color('ffdab9')" bgcolor="#ffdab9" width="50"></td>
<td onClick="bb1.style.backgroundColor='66cdaa';set_color('66cdaa')" bgcolor="#66cdaa" width="50"></td>
<td onClick="bb1.style.backgroundColor='a9a9a9';set_color('a9a9a9')" bgcolor="#a9a9a9" width="50"></td>
</tr>
</table>
</div></td>
</tr>
</div>
.....我的网页文字内容
</font></form></body>提问如下:
<说明>通过以上生成的一定颜色的表格实现网页的背景色,但是颜色过于单一,我想实现点击单元格以使网页内出现渐进色。<问题>有没有办法在网页运行后,通过点击单元格来实现网页的渐进色吗?(某个颜色---->白色)<补充>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#a9a9a9,endColorStr=#ffffff)" >
以上代码在运行前添加可实现渐进色效果,但是能不能在运行时改变body的样式呢?请高手帮忙?
function get_cookie(name_to_get) {
var cookie_pair
var cookie_name
var cookie_value
var cookie_array = document.cookie.split("; ")
// Run through the cookies
for (counter = 0; counter < cookie_array.length; counter++) {
// Split the cookie into a name/value pair
cookie_pair = cookie_array[counter].split("=")
cookie_name = cookie_pair[0]
cookie_value = cookie_pair[1]
// Compare the name with the name we want
if (cookie_name == name_to_get) {
// If this is the one, return the value
return unescape(cookie_value)
}
}
// If the cookie doesn't exist, return null
return null
}
// Get the bgColor cookie
var bg_color = get_cookie("bgColor_cookie")
// Did the cookie exist?
//if (bg_color) {
// document.bgColor = bg_color
//}
function set_color(color_val) {
// Get the currently selected color
//var color_list = color_form.color_name
//var selected_color = color_list.options[color_list.selectedIndex].value
// Change the color of the background
//opener.document["bgColor"] = color_val
// Save it in a cookie
set_cookie("bgColor_cookie", color_val, 365, "/")
}
function set_cookie(cookie_name, cookie_value, cookie_expire, cookie_path, cookie_domain, cookie_secure) {
// Begin the cookie parameter string
var cookie_string = cookie_name + "=" + cookie_value
// Add the expiration date, if it was specified
if (cookie_expire) {
var expire_date = new Date()
var ms_from_now = cookie_expire * 24 * 60 * 60 * 1000
expire_date.setTime(expire_date.getTime() + ms_from_now)
var expire_string = expire_date.toGMTString()
cookie_string += "; expires=" + expire_string
}
// Add the path, if it was specified
if (cookie_path) {
cookie_string += "; path=" + cookie_path
}
// Add the domain, if it was specified
if (cookie_domain) {
cookie_string += "; domain=" + cookie_domain
}
// Add the secure Boolean, if it's true
if (cookie_secure) {
cookie_string += "; true"
}
// Set the cookie
document.cookie = cookie_string
}
if (bg_color) {
bb1.style.backgroundColor = bg_color
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#a9a9a9,endColorStr=#ffffff)" ><form id="bb1">
<div align="left">
<tr>
<td width="281"><div align="left">
<table border="1" width="240" cellspacing="0" cellpadding="1" height="12" id="table1" style="border-collapse: collapse" bordercolor="#000000">
<tr>
<td onClick="bb1.style.backgroundColor='ffffff';set_color('ffffff')" bgcolor="#ffffff" width="50"></td>
<td onClick="bb1.style.backgroundColor='E8FFF3';set_color('E8FFF3')" bgcolor="#E8FFF3" width="50"></td>
<td onClick="bb1.style.backgroundColor='F1E8FF';set_color('F1E8FF')" bgcolor="#F1E8FF" width="50"></td>
<td onClick="bb1.style.backgroundColor='B4E7D9';set_color('B4E7D9')" bgcolor="#B4E7D9" width="50"></td>
<td onClick="bb1.style.backgroundColor='CDCDDE';set_color('CDCDDE')" bgcolor="#CDCDDE" width="50"></td>
<td onClick="bb1.style.backgroundColor='00bfff';set_color('00bfff')" bgcolor="#00bfff" width="50"></td>
<td onClick="bb1.style.backgroundColor='6495ed';set_color('6495ed')" bgcolor="#6495ed" width="50"></td>
<td onClick="bb1.style.backgroundColor='ffdab9';set_color('ffdab9')" bgcolor="#ffdab9" width="50"></td>
<td onClick="bb1.style.backgroundColor='66cdaa';set_color('66cdaa')" bgcolor="#66cdaa" width="50"></td>
<td onClick="bb1.style.backgroundColor='a9a9a9';set_color('a9a9a9')" bgcolor="#a9a9a9" width="50"></td>
</tr>
</table>
</div></td>
</tr>
</div>
.....我的网页文字内容
</font></form></body>提问如下:
<说明>通过以上生成的一定颜色的表格实现网页的背景色,但是颜色过于单一,我想实现点击单元格以使网页内出现渐进色。<问题>有没有办法在网页运行后,通过点击单元格来实现网页的渐进色吗?(某个颜色---->白色)<补充>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#a9a9a9,endColorStr=#ffffff)" >
以上代码在运行前添加可实现渐进色效果,但是能不能在运行时改变body的样式呢?请高手帮忙?
解决方案 »
- extjs 4里model中使用的mapping 什么意思 怎么用?
- 关于google自定义搜索的搜索样式问题
- js操作列表/菜单(select/option)的问题
- 求一个Javscript验证
- 今天发现了个浏览器兼容问题,给大家提个醒,前20楼有分送哦
- 怎么样才能控制图片的点击效果?让图片点击时,换张图
- 如何实现网易邮箱中的邮件拖动,放入回收站的功能?
- cookie处理的问题
- jquery如何通过CLICK事件来做删除?并且删除后不刷新页面动态显示最新结果
- 怎样用javascript隐藏一个打开的浏览器窗口(用window.open打开)
- 纵向js相册 缩略图上onmouseover时 大图有随机特效
- jquery 的写法有些不明白
你给的例子是鼠标移到到时的渐进色,而且是局部的,我要的是点击之后全局的渐进色。等待......