工作流的设置,(表格操作)

-3- javascript 专栏收录该内容
9 篇文章 0 订阅
< HTML >< HEAD >< TITLE > 无标题文档 </ TITLE >< META HTTP - EQUIV = "Content-Type" CONTENT = "text/html; charset=gb2312" >< META HTTP - EQUIV = "imagetoolbar" CONTENT = "no" >< META NAME = "Author" CONTENT = "野猪*钦枫.制作" >

<
STYLE TYPE = "text/css" ><!--

a , a : link { text - decoration : none ; color : #000000; font-size:9pt;}    a:visited{text-decoration: none; color:#000000;}    a:hover{text-decoration: underline; color:red;}

BODY , TD , SELECT { FONT - SIZE : 9pt ; FONT - FAMILY : "宋体" ;}

--></
STYLE >

<
script language = "javascript" type = "text/JavaScript" >

var
i = 1 ;

var
mole = false ;

var
EditObj = null ;

var
oClickTR ;

    function
InsertTR ( strObjName , strUserName ){

        if(!
strObjName || ! strUserName )return;

        var
obj = document . getElementById ( 'SWlist' );

        var
TR = obj . insertRow ();

        var
TD1 = TR . insertCell (), TD2 = TR . insertCell (), TD3 = TR . insertCell (), TD4 = TR . insertCell (), TD5 = TR . insertCell (), TD6 = TR . insertCell ();

        
TR . align = 'center' ;

        
TR . id = 'ListTR' ;

        
TR . bgColor = "#eeeeee" ;

        
TD1 . innerText = i ;

        
TD2 . innerText = strObjName ;

        
TD3 . innerText = strUserName ;

        
TD4 . innerHTML = '<a href=/"#/" οnclick=/"EditTR(this);/">修</a>' ;

        
TD5 . innerHTML = "<a href=/"#/" οnclick=/"DelTR();/">删</a>" ;

        
TD6 . innerHTML = '<a href=/"#/" οnclick=/"MoveTR();/">上移</a>&nbsp;&nbsp;<a href=/"#/" οnclick=/"MoveTR();/">下移</a>' ;

        
form1 . t1 . value = '' ;

        
form1 . t2 . value = '' ;

        
form1 . t1 . focus ();

        
i ++;

    };



    function
EditTR ( o ){

        
form1 . t1 . value = event . srcElement . parentElement . parentElement . children [ 1 ]. innerText ;

        
form1 . t2 . value = event . srcElement . parentElement . parentElement . children [ 2 ]. innerText ;

        
EditObj = o ;

        
mole = true ;

    };



    function
EditSave ( strObjName , strUserName ){

        if(!
strObjName || ! strUserName )return;

        var
obj = EditObj . parentElement . parentElement ;

        var
TD2 = obj . children [ 1 ];

        var
TD3 = obj . children [ 2 ];

        
TD2 . innerText = strObjName ;

        
TD3 . innerText = strUserName ;

        
form1 . t1 . value = '' ;

        
form1 . t2 . value = '' ;

        
form1 . t1 . focus ();

        
mole = false ;

        
EditObj = null ;

    };



    function
DelTR (){

        var
CZobj = document . getElementById ( 'SWlist' );

        var
obj = event . srcElement ;

        
CZobj . deleteRow ( obj . parentElement . rowIndex );

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

            
ListTR [ i ]. children [ 0 ]. innerText = i + 1 ;

    };



    function
MoveTR (){

        var
CZobj = document . getElementById ( 'SWlist' );



        var
TrIndex = event . srcElement . parentElement . parentElement . rowIndex - 2 ;



        if(
event . srcElement . innerText == '上移' && TrIndex > 0 ){

            
CZobj . moveRow ( TrIndex , TrIndex - 1 );

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

                
ListTR [ i ]. children [ 0 ]. innerText = i + 1 ;

        }

        else if(
event . srcElement . innerText == "下移" && TrIndex < ListTR . length - 1 ){

            
CZobj . moveRow ( TrIndex , TrIndex + 1 );

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

                
ListTR [ i ]. children [ 0 ]. innerText = i + 1 ;

        }else{

            return;

        }

    };



    function
ClickTR (){

        if(
oClickTR != null && oClickTR . tagName == "TR" ) oClickTR . bgColor = "#eeeeee" ;

        
oClickTR = event . srcElement . parentElement ;

        if(
oClickTR . tagName == "TR" ) oClickTR . bgColor =( oClickTR . bgColor == "#eeeeee" )? "#ffffff" : "#eeeeee" ;

    };




    function Save(){

        var
hdINPUT='';

        if(
typeof(ListTR)=='undefined'){alert("&Ccedil;&euml;&Igrave;í&frac14;&Oacute;&Iuml;&icirc;!");return;}

        if(
typeof(ListTR.length)=='undefined'){

            var
strObjName=ListTR.children[1].innerText;

            var
strUserName=ListTR.children[2].innerText;

            
hdINPUT+="<input type=/"text/" name=/"strObjName[]/" value=/""+strObjName+"/"><input type=/"hidden/" name=/"strUserName[]/" value=/""+strUserName+"/">";

        }else{

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

                var
strObjName=ListTR[i].children[1].innerText;

                var
strUserName=ListTR[i].children[2].innerText;

                
hdINPUT+="<input type=/"text/" name=/"strObjName[]/" value=/""+strObjName+"/"><input type=/"hidden/" name=/"strUserName[]/" value=/""+strUserName+"/">";

            }

        }

        
form1.insertAdjacentHTML("afterBegin", hdINPUT);

        
form1.submit();

        
form1.b2.disabled=true;

    };


</script>

</HEAD>



<BODY bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">

<div style="border:1px #7d7d7d solid;">

<form name="form1" method="post" action="test.php">

    步骤名称<input type="text" name="t1" /><br />

    执行人<input type="text" name="t2" /><br />

    <input type="button" value="添加" name="b1" οnclick="(!mole)?InsertTR(t1.value, t2.value):EditSave(t1.value, t2.value)" />

    <input type="button" value="保存" name="b2" οnclick="Save();" />

</form>

</div>

<table width="645" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCC" style="border-collapse:collapse;">

  <tr>

    <td colspan="6" align="center">步骤列表</td>

  </tr>

  <tr align="center" bgcolor="#99CCFF">

    <td width="57">序号</td>

    <td width="190">步骤名称</td>

    <td width="124">执行人</td>

    <td width="84">修改</td>

    <td width="84">删除</td>

    <td width="92">调整</td>

  </tr>

<Tbody id="SWlist" οnclick="ClickTR();"></Tbody>

</table>

</BODY>

</HTML>
  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值