用jquery如何实现点击一栏目实现栏目变色,再点击另一栏目也变色,但原来的变回原色,我有个数组a(1,2,3,我循环遍历输出a的值。 代码如下:<ul> <li><a onclick="show();"><b>a[0]<b><a></li> <li><a onclick="show();"><b>a[1]<b><a></li> <li><a onclick="show();"><b>a[2]<b><a></li> 点击1,1变色,点击2,2变色,但1会变回原来的颜色.我show方法实现了其他的功能. 下面是我初试的代码: HTML code: 代码如下:<style type="...
天使用jQuery获取样式中的background-color的值时发现在获取到的颜色值在IE中与Chrome、Firefox显示的格式不一样,IE中是以HEX格式显示#ffff00,而Chrome、Firefox中则是以GRB格式显示rgb(255,0,0),由于需要将颜色值存储到数据库中,所以想让颜色值的格式统一下(其实不统一也是可以存的)。搜索了一下,从国外的一个网站上得到一段代码 代码如下:$.fn.getHexBackgroundColor = function() { var rgb = $(this).css('background-c...
JQuery实现: 代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script type="text/javascript" src="jquery-core/jquery-1.8.0.js"></script> <script type="text/javascript"> $(function(){ //...
JS控制按钮自动切换背景颜色,可暂停_脚本之家 .grigg{ position:relative; font-family:Verdana; font-size:16px;color:#ffffff; } y=" "; function colourWrite(){ y=document.bgColor; if (document.layers) {x=document.FM.box.value} if (document.all) {x=document.all.kurt.innerHTML} r=x+=y.toUpperCase(); Wrte=r+" "; if (document.layers) { document.FM.box.value=Wrte; document.layers.kurt.documen...
效果演示:源代码: 代码如下:<script style="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script> </head> <body id=a> <h2 class=a>Single images</h2> <div id=bsfdimg style=background:url("/upload/201112/20111212204031245.jpg") no-repeat scroll -50px -50px transparent;width:260px;height:200px; w=392 h=600></div> <script type=text/javascript> v...
代码如下:<style> .uboxstyle{width:174px;height:39px; float:right;} #uboxstyle{width:174px;height:39px; float:right;} #uboxstyle .select_box{width:174px;height:39px; float:left;} #uboxstyle div.tag_select{display:block;color:#79A2BD;width:174px;height:39px;background:transparent url("images/select01.jpg") no-repeat 0 0;padding:0 10px;line-height:39px;} #uboxstyle div.tag_select_hover{display:block;...
代码如下:$(document).ready(function () { //按钮样式切换 $("#btFeedBack").hover( function () { $(this).removeClass("btFeed").addClass("btFeedhover"); }, function () { $(this).removeClass("btFeedhover").addClass("btFeed"); } ); });
HTML部分代码: 代码如下:<ul> <li>鼠标经过时改变背景色</li> <li>鼠标经过时改变背景色</li> <li>鼠标经过时改变背景色</li> <li>鼠标经过时改变背景色</li> </ul> javascript部分代码: 当鼠标经过时,给li添加class="current"类,鼠标离开时,去除该类,达到改变背景色的目的 代码如下:window.onload = function() { var lis = document.getElementsByTagName("li"); for (var i=0; i<lis.length; i++) { lis[i].onmouseove...
这段JS放在head中 代码如下://点击当前选中行的时候设置当前行的颜色,同时恢复除当前行外的行的颜色及鼠标事件 function selectRow(target) { var sTable = document.getElementById("ServiceListTable") for(var i=1;i<sTable.rows.length;i++) //遍历除第一行外的所有行 { if (sTable.rows[i] != target) //判断是否当前选定行 { sTable.rows[i].bgColor = "#ffffff"; //设置背景色 sTable.rows[i].onmouseover = resumeRowOve...
html代码 代码如下:<!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> <title>背景切换</title> <link href="css/bgchage.css" type="text/css" rel="Stylesheet" /> </head> <body> <div><ul><li></li><li></li><li></li><li></li></ul></div> <!-- <div>1</div><div>2</div><div>3</div><div>4...
新浪首页可关闭背景效果代码 if(typeof(sina)!="object"){var sina={}} sina.$=function(i){if(!i){return null} return document.getElementById(i)};var sinaFlash=function(V,x,X,Z,v,z,i,c,I,l,o){var w=this;if(!document.createElement||!document.getElementById){return} w.id=x?x:'';var O=function(I,i){for(var l=0;l-1){w.ver=C}else{w.ver=v?v:C} w.ver=w.ver.replace(/\./g,',');w.__classid="clsid:D27CDB6E-AE...
上代码: Demo #div1 { padding: 10px; width: 380px; height: 205px; background: url(/upload/201007/20100713220102894.jpg); } #div2 { color: #FFF; font-size: 40px; font-weight: bold; text-align: center; height: 205px; line-height: 205px; background: rgba(125, 0, 0, .3); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4B7D0000 ,endColorstr=#4B7D0000); } Hello world! ...
点击页面上的按纽,弹出一个层,背景变灰 点击页面上的按纽,弹出一个层,背景变灰 function sAlert(str) { var msgw,msgh,bordercolor; msgw=400;//提示窗口的宽度 msgh=100;//提示窗口的高度 titleheight=25 //提示窗口标题高度 bordercolor= "#336699 ";//提示窗口的边框颜色 titlecolor= "#99CCFF ";//提示窗口的标题颜色 var sWidth,sHeight; sWidth=document.body.offsetWidth;//浏览器工作区域内页面宽度 sHeight=...
后台代码 代码如下:/// <summary> /// 数据行绑定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvProduct_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow ) { GridViewRow row = e.Row; CheckBox ckb = row.Cells[0].FindControl("ckb") as CheckBox; Label ProductID = row.Cells[0].FindControl("lblP...
前几天,在QQ群里有个XD问到bgsound的一些资料,确切地说是它的特殊用法。奇怪群里的人竟然都没几个能说出新意的,包括我!或许是这个标签不常用、或者是用处不大,所以,大家也就没有特意去研究过背景音乐吧。(以前自学这个东西时,本人也是仅仅出于好奇,玩玩而已^_^) 废话少说,来点真格的…… (以下是原文,不仅仅是bgsound哦,还有其他东东,慢慢see) <BGSOUND> 是用以插入背景音乐,但只适用於 IE,其参数设定不多。 <BG...