nonmaol js

function showAddTf(){

$('#dis').show();

$('#wd_dis').show();

document.getElementById("tfId").value=getLocalTime();

}

function addTransfer(){

var id=$("#tfId").val();

var date=$("#txtDt").val();

var tfName=$("#txtHr").val();

$.post("req!addTransfer.action",{"tfInfo.transferNumber":id,"tfInfo.transferDay":date,"tfInfo.transferMan":tfName},function(data){

alert("添加成功");

$('#dis').hide();

$('#wd_dis').hide();

window.location.href="req!search.action";

});

}

function getLocalTime(){

var monstr;

var datestr;

var myDate = new Date();    

    var year=myDate.getFullYear();      

var month=myDate.getMonth()+1;   

var date=myDate.getDate();

if(month<10) 

monstr="0"+month;

else

monstr=""+month;


if(date<10) 

datestr="0"+date;

else

datestr=""+date;

var dt=myDate.getDay()

var minutes=myDate.getMinutes();         

var hms=myDate.getMilliseconds();     

    var strId=year.toString()+monstr+datestr+minutes.toString()+dt.toString()+hms.toString();

    return strId;

}

$(function(){

$("#txtDt").datepicker();

});

function back_main(){

window.location.href="req!search.action";

}

/**

 * 加载获取表单单击Tf事件

 */

 function on_load(){

showtable('table1');

$("#table1 tr:not('#table1 tr:eq(0)')").find("td:eq(0),td:eq(1),td:eq(2),td:eq(3)").click(function(){

var TfId=$(this).parent().find("td:eq(0)").html();

var TfNumId=$(this).parent().find("td:eq(1)").html();

alert(TfId);

$.XYTipsWindow({

___title:"添加需求信息",

___content:"iframe:show_requireInfo.jsp?value="+TfNumId+"="+TfId,

___width:"500",

___height:"300",

___showbg:true,

___drag:"___boxTitle",

___boxBdColor:"#587BE8",

});

});

}

/**

 * table显示效果

 */

function showtable(id){

    var tableid='table';       

    var overcolor='#ffe3bc';    

    var color1='#faf7ed';        

    var color2='#ffffff';        

    var tablename=document.getElementById(id);

    var tr=tablename.getElementsByTagName("tr");

    for(var i=0 ;i<tr.length;i++){

tr[i].onmouseover=function(){

            this.style.backgroundColor=overcolor;

        }

        tr[i].onmouseout=function(){

            if(this.rowIndex%2==0){

                this.style.backgroundColor=color1;

            }else{

                this.style.backgroundColor=color2;

            }

        }

if(i%2==0){

            tr[i].style.backgroundColor=color1;

        }else{

            tr[i].style.backgroundColor=color2;

        }

    }

}

/*

 *添加Requer信息

 */

function addRequire(id){

 var params = $("#addForm").serialize();

 var addParams=params+"&require.transferInfo.transferNumber="+id;

 $.post("req!addRequire.action",addParams,function(data){

alert("添加成功");

location.href = "req!search.action";

});

}


你可能感兴趣的:(nonmaol js)