javascript常用方法12

//返回ID字符串为数组形式
function getEmenValeThree(objid){
var form=$(objid),eles = form.elements;
var reId="";
var arr=new Array();
var count = 0;
if (eles.length > 0){
var checkedboxNum=0; //选中的复选筐
for (var i=0; i<eles.length; i++){
var node = eles[i];
if (node.type == "checkbox" && node.disabled == false){
if(node.checked){
arr[count++] = eles[i].value;
}

}
}
}
return arr;
}


GetoffsetLeft = function(theObject)
{ //return theObject's absolute offsetLeft . translate by stz: 返回对象在页面中的绝对左距离

var absLeft = 0;

var thePosition="";

var tmpObject = theObject;

while (tmpObject != null)
{
thePosition = tmpObject.position;
tmpObject.position = "static";
absLeft += tmpObject.offsetLeft;
tmpObject.position = thePosition;
tmpObject = tmpObject.offsetParent;
}
return absLeft;
}

GetoffsetTop = function(theObject)
{ //return theObj's absolute offsetTop
var absTop = 0;
var thePosition = "";
var tmpObject = theObject;
while (tmpObject != null)
{
thePosition = tmpObject.position;
tmpObject.position = "static";
absTop += tmpObject.offsetTop;
tmpObject.position = thePosition;
tmpObject = tmpObject.offsetParent;
}
return absTop;
}


/*-----------------tab页效果---------------------------------*/
var CurComId=1,widthed=0;
function switchComment(Id,tabbar){
var tab=$("tab");
for(var i=0;i<tab.childNodes.length;i++) {
if(tab.childNodes[i].className!="horizontalSpace")
tab.childNodes[i].className="unitOff"
}//alert(tabbar.outerHTML);
tabbar.className="unitOn"
CurComId=Id;
}
function switchComment2(Id,tabbar){
var tab=$("tab"), imgBg=tab.style.backgroundImage; //alert(imgBg.substring(imgBg.indexOf("."),imgBg.length));
var imgNumPos=imgBg.lastIndexOf("."); //alert(imgBg.substring(imgNumPos-1,imgNumPos)); return;
tab.style.backgroundImage=imgBg.replace(imgBg.substring(imgNumPos-1,imgNumPos),Id);
//tab.style.backgroundImage=imgBg.replace(imgBg.substr(imgBg.length),Id);
if (Id!=CurComId){
eval("document.getElementById('tab" + Id.toString() + "').style.display='block';");
eval("document.getElementById('tab" + CurComId.toString() + "').style.display='none';");
CurComId=Id;
}
}

function showFAQlist(curObj){
var oprObj=curObj.nextSibling;
while(oprObj.nodeType!=1){
oprObj=oprObj.nextSibling;
}//alert(oprObj.nodeType); return;//.parentNode.childNodes[1] word_bold cursorHand
if(oprObj.style.display==""){
oprObj.style.display="none";
curObj.className="word_bold cursorHand";
}else{
oprObj.style.display="";
curObj.className="word_666 word_bold cursorHand"; //word_black
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值