第一个JS$(document).ready(function(){
$('.son_ul').hide(); //初始ul隐藏
$('.select_box span').hover(function(){ //鼠标移动函数
$(this).parent().find('ul.son_ul').slideDown();  //找到ul.son_ul显示
$(this).parent().find('li').hover(function(){$(this).addClass('more')},function(){$(this).removeClass('more')}); //li的hover效果
$(this).parent().hover(function(){},
function(){
$(this).parent().find("ul.son_ul").slideUp(); 
}
);
},function(){}
);
$('ul.son_ul li').click(function(){
$(this).parents('li').find('span').html($(this).html());
$(this).parents('li').find('ul').slideUp();
});
}
);第二个JS
function Scroll(obj, h, s) {     
var h = h || 100;     
var s = s || 1.2;     
var obj = typeof(obj)=="string"?document.getElementById(obj):obj;     
if(obj == undefined){return false;}     
var status = obj.getAttribute("status")==null;    
var oh = parseInt(obj.offsetHeight);     
obj.style.height = oh;     
obj.style.display = "block";     
obj.style.overflow = "hidden";     
if(obj.getAttribute("oldHeight") == null)     
{         
obj.setAttribute("oldHeight", oh);     
}else    
{     
var oldH = Math.ceil(obj.getAttribute("oldHeight")); }   
var reSet = function() {     
if(status)     
{        
 if(oh < h)         
{             
oh = Math.ceil(h-(h-oh)/s);             
obj.style.height = oh+"px";         
}         
else        
{             
obj.setAttribute("status",false);             
window.clearInterval(IntervalId);         
}     
}     
else    
{         
obj.style.height = oldH+"px";         
obj.removeAttribute("status");         
window.clearInterval(IntervalId);     

}
var IntervalId = window.setInterval(reSet,10); return status; 
}
var $ = function(id){return document.getElementById(id)}; 
var number = document.getElementsByTagName('div'); 
window.onload= function() 
{     
for(var i = 0;i < number.length ;i++)     
{         
(function(i)         
{             
$('test'+i+'').onclick = function()             
{                 
Scroll('test'+i+'',this.scrollHeight,1.2);             
}         
}         
)(i);     

} 第一个前端代码<div id="main_box" class="soso">
<ul>
  <li class="select_box">
    <span>搜全部</span>
    <ul class="son_ul">
      <li>找商户</li>
      <li>找优惠</li>
      <li>找商品</li>
    </ul>
  </li>
</ul>
</div>
单独拿出来都没问题,但放在一起就有问题了,第二个展开可以用,第一个失效。google提示冲突。
$('.son_ul').hide();和这个有冲突$('test'+i+'').onclick = function() 搞了半天没搞定,求解,搞定马上结贴给分~!十万分感谢