
各位大侠,以下虽然定义了两个样式,但样式二却包含了样式一了,也就是样式二的那个除了执行样式二之外,还同时执行了样式一,我想让他们两个独立,不相互包容,怎么改呢?
样式一图
样式二图
样式一:不修改这里
红色 ---------------------------------------------------------------------------------------------
样式二:这里跟上面重复样式,如何修改
商品介绍
评价详情
成交记录
1
2
3
回复讨论(解决方案)
是不是点击之后出的效果,js呢?贴出来
script>
script>
function selectTag(showContent,selfObj){
var tag = document.getElementById("tags").getElementsByTagName("li");
var taglength = tag.length;
for(i=0; i
tag[i].className = "";
}
selfObj.parentNode.className = "selectTag";
for(i=0; j=document.getElementById("tagContent"+i); i++){
j.style.display = "none";
}
document.getElementById(showContent).style.display = "block";
}
script>
window.onload=function(){
var size = new Select("size",{
Radio :true ,
OnClick:function(selected){
document.form.size.value = selected.join(",")
document.form.color.value='';
}
});
}
script>
$(function() {
$('#tabs').tabs();
});
script>
S X XL 商品介绍 评价详情(0) 成交记录(50) 001 002 003 |
function Select(id,config){
this.config = config||{};
this.id = typeof(id)=='string'?document.getElementById(id):id;
this.items = this.id.getElementsByTagName("li");
this.selectClass = "select";
this.selected = new Array();
var _this = this;
this.selectOpt = function(value,opt){
var exist = false;
for(var i=0;i<_this.selected.length;i++){
if(_this.selected[i]==value){
exist = true ;
if(opt=="remove"){ _this.selected.splice(i,1);}
break;
}
}
if(!exist && opt=="add"){_this.selected.push(value);}
};
//初始化对象
(function(_this){
//是否有默认配置的选择项
if(_this.config.Default){
var arr = _this.config.Default.split(",");
for(var i=0;i }
for(var i=0;i<_this.items.length;i++){
//将defalut中配置的项加上样式
if( _this.selected.join(",").indexOf(_this.items[i].getAttribute('dataValue'))>-1 && _this.items[i].className==""){
_this.items[i].className=_this.selectClass;
}
//如果有样式中定义了默认
if(_this.items[i].className==_this.selectClass){
_this.selectOpt(_this.items[i].getAttribute('dataValue'),"add");
}
//加点单击事件
_this.items[i].onclick=function(){
//是否为单选
var radio = _this.config.Raido?_this.config.Raido:true;
if(_this.config.Radio==null || _this.config.Radio){
if(this.className!=_this.selectClass){
var items = this.parentNode.getElementsByTagName("li");
for(var i=0;i
items[i].className="";
}
_this.selected.length = 0;
_this.selected.push(this.getAttribute('dataValue'));
this.className=_this.selectClass;
}
}else{
var Max = _this.config.Max?_this.config.Max:1;
if(this.className==_this.selectClass){
this.className="";
_this.selectOpt(this.getAttribute('dataValue'),"remove");
}else{
if(_this.selected.length>=Max){
alert("最多只能选择"+Max+"项");
}else{
this.className=_this.selectClass;
_this.selectOpt(this.getAttribute('dataValue'),"add");
}
}
}
//去掉那个虚线框
this.firstChild.blur();
//调用回调函数
if(_this.config.OnClick)_this.config.OnClick.call(this,_this.selected);
return false;
}
}
})(_this);
}
script>
楼主 说 a:hover 的效果 重叠了吗?
script> script> function selectTag(showContent,selfObj){var tag = document.getElementById("tags").getElementsByTagName("li");var taglength = tag.length;for(i=0; iwindow.onload=function(){ var size = new Select("size",{ Radio :true , OnClick:function(selected){ document.form.size.value = selected.join(",") document.form.color.value='';}});} script>$(function() {$('#tabs').tabs();}); script> SXXL 商品介绍 评价详情(0) 成交记录(50) 001002003 |
@calmcrime
对的。内容A的样式和内容B的样式重叠了,我想实现的是:内容A用内容A的样式,内容B用内容B的样式,互不干扰。谢谢
因为内容A的样式比较重要,所以希望大哥能帮我修改内容B的样式,不要修改A的样式,谢谢
是3楼的意思吗?
是3楼的意思吗?
大侠,我留言给你了,麻烦你看看,或者加我QQ 77644278,在QQ里截图给你看可能更清晰一些,谢谢!
@calmcrime
大侠,或者你把代码做成HTML文件,就能看到具体是什么情况了。
有什么问题 就在这儿说, 截图贴上来吧
@calmcrime
大侠,我弄个链接给你看比较直观吧
http://www.heredc.com/js/a.htm
给样式2重新指定:
border:0px;
不行吗?