backgroundaction的简单介绍
网站导航栏目背景设置
要用到 javascript 我平常习惯用 jQuery 所以我用jquery来说
首先定义一个 css类样式 比如
.action{
background-color: red;
}
要实现的就是 平常“首页”有这个样式,其他导航栏目没有
绑定导航条栏目的 mouseover 事件监听
假设导航条的html代码
div?class="nav"
????ul
????????li?class="action"首页/li
????????li次页/li
????????li其他/li
????/ul
/div
那么js部分就是这样:
$(".nav?li").on("mouseover",?function(){
????//?设置当前项样式并移除同级其他元素样式
????$(this).addClass("action").siblings().removeClass("action");
}
java改变按钮颜色
为yellow、blue、red3个按钮添加actionlistener,当按钮点击时执行setBackground(backgroundColor),同时执行 按钮.setBackground(backgroundColor)即可,比如:
JButton btnYellow = null;
JButton btnBlue = null;
JButton btnRed = null;
btnYellow.setActionCommand("yellow");
btnBlue.setActionCommand("blue");
btnRed.setActionCommand("red");
public void actionPerformed(ActionEvent e) {
String command = event.getActionCommand();
if( "yellow".equals(command) ){
setBackground(Color.yellow);
btnYellow.setBackground(Color.yellow);
}else if( "blue".equals(command) ){
setBackground(Color.blue);
btnBlue.setBackground(Color.blue);
}else if( "red".equals(command) ){
setBackground(Color.red);
btnRed.setBackground(Color.red);
}
}
写出了部分代码
网页制作 标签table在活动版本中不具有属性background是怎么回事?
你form 的位置 不对
你这是做DW生成的吗
你关了再打开 就会出 提示 不过 talbe中 什么也没有也是没有事的
因为网页在最后都要调用统一的css 写了有时 还要费事
你可是调用 外部 css 来进行 样式统一
jsp 中td background不显示背景
用 style="background-image:url('images/pcard1.gif')"
绝对可以的。
url中图片路径不对的话,是无法显示背景图片的。
你先找个可以显示的图片来试试.
如,用下面的代码建立一个html文件。
!--开始 --
table
tr height="200" width="300"
td style="background-image:url('');width='100%'"1000/td
td/td
/tr
/table
!--结束 --
用下面这个绝对可以。
style="background-image:url('images/pcard1.gif')"
用这个也行
style="background:url('images/pcard1.gif')"
JS变量定义backgroundPosition
function?ActionR()
{
????var?box2?=?document.getElementById('box2');????
????if(?number2?=?0)
????{
????????var?picX?=?50;
????????var?picXP?=?picX?+?"px";
????????
????????number2++;
????????box2.style.width?=?picXP;
????????box2.style.backgroundPosition?=?picXP?+?"?0px";
????}
}