不说废话。直接上代码
//仿jQuery mobile Select控件
//使用方法box为容器id,_id指控件id,selectvalue为选中值,Value为当前值
function SelectBox(box,_id,selectvalue,Value)
{
	if(Value != selectvalue)
	{
		$("#" + box).html("<input type=hidden value='" + Value + "' id='" + _id + "'><span id=\"on" + _id + "\" class=\"on\" style=\"width:0px\"></span><span id=\"off" + _id + "\" class=\"off\"></span>");
		$("#off" + _id).css("width","82px");
	}
	else
	{
		$("#" + box).html("<input type=hidden value='" + Value + "' id='" + _id + "'><span id=\"on" + _id + "\" class=\"on\"></span><span id=\"off" + _id + "\" class=\"off\" style=\"width:0px\"></span>");
		$("#on" + _id).css("width","82px");
	}
	$("#on" + _id).click(function(){
		$("#on" + _id).animate({width:"0px"},100);
		$("#off" + _id).animate({width:"82px"},100);
		$("#" + _id).val(Value);
	});
	$("#off" + _id).click(function(){
		$("#on" + _id).animate({width:"82px"},100);
		$("#off" + _id).animate({width:"0px"},100);
		$("#" + _id).val(selectvalue);
	});
}

 

用法:

 



 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-02-07
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-04-20
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案