jquery动态添加删除(tr/td),jquerytr

?phpif (isset($_GET[‘action’]) $_GET[‘action’]==’update’卡塔尔国{
//update notice data //上传文件 require_once(upload_class.php); $f =
new Upload( $savepath, $fileFormat, $maxsize, $overwrite); if
(!$f-run(‘img’卡塔尔(قطر‎卡塔尔 {//上边包车型大巴img是Form中上传文书的input的名字 echo
$f-errmsg(State of Qatar;
//这里只好传递最终贰个失误的消息,详细的音信在$f-getInfo(卡塔尔国中能够赢得。
print_r($f-returnArray); } echo script
src=.__FILENAME__./js/jquery.js type=text/javascript/script script
var ptext=”; ptext=OK; //alert($(‘#img_view’).html());
parent.$(‘#img_view’).html(ptext);/script;}?!DOCTYPE html PUBLIC
-//W3C//DTD XHTML 1.0 Transitional//EN xmlns= content=text/html;
charset=utf-8 /link href={{$tempurl}}/admin.css rel=stylesheet
type=text/css /link href={{$baseurl}}/js/calendar/default/datePicker.css
rel=stylesheet type=text/css /script
src={{$baseurl}}/js/calendar/WdatePicker.js
type=text/javascript/scriptscript src={{$baseurl}}/js/jquery.js
type=text/javascript/scriptscript src={{$baseurl}}/js/Forms.js
type=text/javascript/scriptscript src={{$baseurl}}/js/FormValid.js
type=text/javascript/scriptscript type=text/javascript FormValid.succeed
= function (卡塔尔 {
$.post(./article.php?action=update,$.getForms(update卡塔尔国,function (msg卡塔尔{
alert(msg卡塔尔; if(msg==更新通告成功卡塔尔 { location.href(./article.php卡塔尔; }
//location.href({{$baseurl}}/index.php卡塔尔; }卡塔尔国; return false; }function
file_addupload(type卡塔尔国{ //负担扩展图片输入框 var ptext=”;
ptext=$(#+type+_more).html()+br /input type=’file’ name=’+type+[]’
class=’input’ /;
$(#+type+_more卡塔尔(قطر‎.html(ptextState of Qatar;}/scripttitle公布小说–编辑页面/title/headbody
table width=99% border=0 cellpadding=0 cellspacing=1 class=install tr td
colspan=2 class=title编辑文章内容/td /tr {{section name=article
loop=$article}} form action=./article.php?action=update method=post
name=update enctype=multipart/form-data target=upload_iframe input
type=hidden name=article_id value={{$id}} tr td class=left文章标题:/td
td class=rightinput type=text id=title name=article_title
value={{$article[article].title}} class=input size=35 valid=required
errmsg=文章标题不可能为空 //td /tr tr td class=left发表IP:/td td
class=rightinput type=text id=ip value={{$article[article].ip}}
name=ip class=input readonly //td /tr tr td class=left作者:/td td
class=rightinput type=text id=author name=article_validtime
value={{$article[article].author}} valid=required
errmsg=请输入作品小编 //td /tr tr td class=left分类:/td td
class=rightselect name=’sort'{{html_options options=$sort_options
selected=$article[article].sort }}/select/td /tr tr td
class=left来源:/td td class=rightinput type=text id=comes name=comes
value={{$article[article].comes}} class=input//td /tr tr td
class=left是或不是置顶:/td td class=right{{html_radios name=’is_top’
options=$is_top_radios checked=$article[article].is_top separator=’
‘ _note=’是不是置顶#124;radio#124;1=是,0=否’ }}/td /tr tr td
class=left内容:/td td class=right{{$editor}}/td /tr tr td
class=left图片上传:/td td class=right span id=img_view input type=file
name=img[] class=input / a href=# onclick=file_addupload(‘img’)++/a
span id=img_more/span /span /tr tr td class=left文件上传:/td td
class=rightinput type=file name=file[] class=input / a href=#
onclick=file_addupload(‘file’)++/a span id=file_more/span/td /tr tr td
colspan=2 class=page style=text-align:center;input type=submit
name=submit class=button value=保存 / input type=button
name=article_return value=返回 class=button
onclick=javascript:location.href(‘./article.php’); //td /tr /form
{{/section}}/tableiframe name=upload_iframe style=width: 400px; height:
100px; display: none;/iframe/body/html

jquery动态拉长删减(tr/td卡塔尔,jquerytr

代码很简单,完结的效应也超轻巧,有须要的伴儿仿效下吧。

复制代码 代码如下:

<head runat=”server”>
    <title></title>
    <!–easyui –>
    <link rel=”stylesheet” type=”text/css”
href=”../../script/jquery-easyui-1.3.2/themes/icon.css” />
    <link rel=”stylesheet” type=”text/css”
href=”../../script/easy_ui/themes/demo.css” />
    <link rel=”stylesheet” type=”text/css”
href=”../../script/jquery-easyui-1.3.2/themes/default/easyui.css”
/>
    <link href=”../../css/function.css” rel=”stylesheet”
type=”text/css” />
    <script type=”text/javascript”
src=”../../script/jquery-1.8.2.js”></script>
    <script type=”text/javascript”
src=”../../script/jquery-easyui-1.3.2/locale/easyui-lang-zh_TW.js”></script>
    <script type=”text/javascript”
src=”../../script/jquery-easyui-1.3.2/jquery.easyui.min.js”></script>
    <script type=”text/javascript”
src=”../../script/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js”></script>
    <!–上传控件 –>
    <link href=”../../css/images/style.css” rel=”stylesheet”
type=”text/css” />
    <script type=’text/javascript’
src=”../../script/swfupload/swfupload.js”></script>
    <script type=’text/javascript’
src=”../../script/swfupload/swfupload.queue.js”></script>
    <script type=”text/javascript”
src=”../../script/swfupload/swfupload.handlers.js”></script>
    <script src=”../../script/jquery.form.min.js”
type=”text/javascript”></script>
    <script type=”text/javascript”
src=”../../script/function.js”></script>
    <!–编辑器 –>
    <script type=”text/javascript” charset=”utf-8″
src=”../../editor/kindeditor-min.js”></script>
    <script type=”text/javascript” charset=”utf-8″
src=”../../editor/lang/zh_CN.js”></script>
    <script type=”text/javascript”>
        /* jquery easyui 操作*/
        window.onload = function () {
            InitGird();
        }
        //加载编辑器
        var editor;
        $(function () {
            editor = KindEditor.create(‘textarea[name=”Describe”]’,
{
                resizeType: 1,
                uploadJson:
‘../ashx/upload_ajax.ashx?action=EditorFile&IsWater=1’,
                fileManagerJson:
‘../ashx/upload_ajax.ashx?action=ManagerFile’,
                allowFileManager: true
            });
        });
        //发轫化上传控件
        $(function () {
            InitSWFUpload(“../ashx/upload_ajax.ashx”, “Filedata”, “1024
KB”, “../../script/swfupload/swfupload.swf”, 1, 1);
        });
        //搜索
        function Search() {
            $(‘#dgCaseInfo’).datagrid(‘load’, {
                action: “loadListPage”,
                Names: $(“#Names”).val()
            });
        }
        //初步化表格
        function InitGird() {
            $(“#dgCaseInfo”).datagrid({
                autoRowHeight: false,
                loadMsg: ‘正在着力加载中…’,
                url:
‘../ashx/GetSm_CaseInformation.ashx?types=loadListPage’,
//央浼数据的页面
                sortName: ‘ID’, //排序字段
                idField: ‘ID’, //标识字段,主键
                iconCls: ”, //标题侧边的图形
                singleSelect: true,
                width: ‘100%’, //宽度
                height: ‘auto’, //高度
                nowrap: true, //是不是换行,True 就能够把数据展现在一行里
                striped: true, //True 奇偶行使用分化背景象
                collapsible: false, //可折叠
                sortOrder: ‘desc’, //排序类型
                remoteSort: true, //定义是不是从服务器给多少排序
                fit: true,
                singleSelect: true, //是或不是只同意接收一行
                selectOnCheck: false, //单击复选框不会选中央银行
                fitColumns: true, //列自动缩放
                columns: [[
                       { 田野(field卡塔尔: ‘Name’, title: ‘商品名称’, width: 200,
align: ‘left’ },
                      { field: ‘Add_Time’, title: ‘增加时间’, width:
100, align: ‘left’ },
                      { field: ‘Describe’, title: ‘描述’, width: 100,
align: ‘left’, hidden: true },
                      { 田野先生: ‘FilePath’, title: ‘案例照片’, width:
100, align: ‘left’,
                          formatter: function (value, row, index) {
                              if (row.FilePath != “”) {
                                  return ‘<a
href=javascript:ShowBigview(‘ + index + ‘)><img alt=”照片”
src=”../..’%20+%20row.FilePath%20+%20′”width=”100px”
height=”25px”/></a>’
                              } else {
                                  return “暂时未有图片”
                              }
                          }
                      },
                      { field: ‘Flag’, title: ‘状态’, width: 100, align:
‘left’,
                          formatter: function (value, row, index) {
                              if (row.Flag == 0) {
                                  return “上架”;
                              } else {
澳门新葡亰娱乐官网 ,                                  return “下架”;
                              }
                          }
                      },
                      { 田野(field卡塔尔(قطر‎: ‘TypeID’, title: ‘商品类型’, width: 100,
align: ‘left’, hidden: true },
                      { 田野: ‘MonadID’, title: ‘集团名称’, width: 100,
align: ‘left’, hidden: true },
                      { 田野: ‘MonadName’, title: ‘集团名称’, width:
100, align: ‘left’, hidden: true }
                      ]],
                toolbar: “#toolbar”,
                queryParams: { “action”: “query” },
                pagination: true, //是不是张开分页
                pagePosition: ‘bottom’, //分页位置
                pageNumber: 1, //私下认可索引页
                pageSize: 10, //私下认可一页数据条数
                onDblClickRow: function (rowIndex, rowDataState of Qatar{//行双击事件
                    Edit();
                }
            })
        }
        var url;
        //增添一条数据
        function Add() {
            $(“#tdLeft”卡塔尔.remove();//删除秒杀时间td
            $(“#tdSeckill”State of Qatar.remove(卡塔尔; //删除秒杀时间td
            loadTypeID();
            editor.html(“”);
            $(‘#dlg’).dialog(‘open’).dialog(‘setTitle’, ‘添加’);
            $(‘#form1’).form(‘clear’);
            url = ‘../ashx/GetSm_CaseInformation.ashx?types=ListAdd’;
            $(“input[name=’Flag’]”).eq(0).attr(‘checked’, ‘true’);
        }
        //编辑纠正
        function Edit() {
            $(“#tdLeft”卡塔尔国.remove(卡塔尔(قطر‎; //删除秒杀时间td
            $(“#tdSeckill”卡塔尔(قطر‎.remove(卡塔尔; //删除秒杀时间td
            loadTypeID();
            url =
‘../ashx/GetSm_CaseInformation.ashx?types=ListEdit’;
            var row = $(‘#dgCaseInfo’).datagrid(‘getSelected’);
            if (row) {
                $(‘#dlg’).dialog(‘open’).dialog(‘setTitle’, ‘修改’);
                $(“#imageCaseUrl”).attr(“src”, “../..” +
$(‘#FilePath’).val()); //设置<image id=”imageCaseUrl”>的url
                editor.html(row[“Describe”]);
                if (row[“IsSeckill”]==1卡塔尔(قطر‎//倘使该商品是秒杀状态 则:
                {
                    $(“#trSeckill”).append(‘ <td id=”tdLeft”
class=”tab_td_right”
style=”width:80px;”>秒杀时间:</td><td id=”tdSeckill”
class=”tab_td_left”><input id=”SeckillDateBegin” 
class=”easyui-datetimebox” name=”SeckillDateBegin”
style=”width:150px”> 至<input id=”SeckillDateEnd” 
class=”easyui-datetimebox” name=”SeckillDateEnd” 
style=”width:150px”></td>’)
                    //开头化easyui日期控件
                    $(‘#SeckillDateBegin’).datetimebox({
                        required: true,
                        showSeconds: false
                    });
                    $(‘#SeckillDateEnd’).datetimebox({
                        required: true,
                        showSeconds: false
                    });
                }
                $(‘#form1’).form(‘load’, row);
                $(“#Flag “).val(row[“Flag”]卡塔尔国; //设置状态值
            }
        }
        //保存数据
        function Save() {
            editor.sync();
            $(‘#form1’).form(‘submit’, {
                url: url,
                onSubmit: function () {
                    return $(this).form(‘validate’);
                },
                success: function (result) {
                    if (result <= 0) {
                        $.messager.show({
                            title: ‘Error’,
                            msg: result.errorMsg
                        });
                    } else {
                        $(‘#dlg’).dialog(‘close’);        // close the
dialog
                        $(‘#dgCaseInfo’).datagrid(‘reload’);    //
reload the user data
                    }
                }
            });
        }
        //删除一条数据
        function destroy() {
            var row = $(‘#dgCaseInfo’).datagrid(‘getSelected’);
            if (row) {
                $.messager.confirm(‘新闻提醒’, ‘明确要刨除吗?’,
function (r卡塔尔国 {
                    if (r) {
                       
$.post(‘../ashx/GetSm_CaseInformation.ashx?types=ListDel’,
                                { id: row.ID },
                                    function (result) {
                                        if (result > 0) {
                                           
$(‘#dgCaseInfo’).datagrid(‘reload’);    // reload the user data
                                        } else {
                                            $.messager.show(
                                        {    // show error message
                                            title: ‘Error’,
                                            msg: result.errorMsg
                                        }
                                        );
                                        }
                                    }, ‘json’);
                    }
                });
            }
        }
        //加载商品系列
        function loadTypeID() {
            $(‘#TypeID’).combobox({
                url:
‘../ashx/GetSm_CaseInformation.ashx?types=TypeIDLoad’,
                valueField: ‘ID’,
                textField: ‘DtyName’
            });
        }
        //点击图片后激情
        function ShowBigview(rowIndex) {
            var row =
$(“#dgCaseInfo”).datagrid(‘getRows’)[rowIndex];
            if (row[“FilePath”].toString() != “”) {
                $.messager.alert(‘大图预览’, ‘<img alt=””  src=../..’

  • row[“FilePath”] + ‘ width=”100px” height=”100px” />’);
                } else {
                    $.messager.alert(‘信息提醒’, ‘未安装标题图片!’State of Qatar;
                }
            }
            //点击单选开关 通常时激发
            function DisDate() {
                $(“#tdLeft”卡塔尔(قطر‎.remove(State of Qatar; //删除秒杀时间td
                $(“#tdSeckill”卡塔尔国.remove(State of Qatar; //删除秒杀时间td
            }
            //点击单选按键 秒杀时激发
            function HideDate() {
                $(“#tdLeft”卡塔尔.remove(卡塔尔国; //删除秒杀时间td
                $(“#tdSeckill”卡塔尔(قطر‎.remove(卡塔尔(قطر‎; //删除秒杀时间td
                $(“#trSeckill”).append(‘ <td id=”tdLeft”
    class=”tab_td_right”
    style=”width:80px;”>秒杀时间:</td><td id=”tdSeckill”
    class=”tab_td_left”><input id=”SeckillDateBegin” 
    class=”easyui-datetimebox” name=”SeckillDateBegin”
    style=”width:150px”> 至<input id=”SeckillDateEnd” 
    class=”easyui-datetimebox” name=”SeckillDateEnd” 
    style=”width:150px”></td>’)
                //初阶化easyui日期控件
                $(‘#SeckillDateBegin’).datetimebox({
                    required: true,
                    showSeconds: false
                });
                $(‘#SeckillDateEnd’).datetimebox({
                    required: true,
                    showSeconds: false
                }); 
            }
        </script>
    </head>
    <body>
        <table id=”dgCaseInfo”>
        </table>
        <div id=”toolbar” style=”width: 100%”>
            <div style=”padding-top: 5px; width: 100%”>
                <a href=”javascript:void(0)” class=”easyui-linkbutton”
    iconcls=”icon-add” plain=”true”
                    onclick=”Add()”>添加</a> <a
    href=”javascript:void(0)” class=”easyui-linkbutton”
    iconcls=”icon-edit”
                        plain=”true” onclick=”Edit()”>编辑</a>
    <a href=”javascript:void(0)” class=”easyui-linkbutton”
                            iconcls=”icon-remove” plain=”true”
    onclick=”destroy()”>删除</a>
            </div>
            成品名称:<input id=”Names” name=”Names”
    class=”easyui-validatebox” type=”text” />
            <a id=”search” href=”#” onclick=”Search()”
    class=”easyui-linkbutton” plain=”true”
                data-options=”iconCls:’icon-search'”>搜索</a>
        </div>
        <div id=”dlg” class=”easyui-dialog” style=”width:800px; height:
    400px; padding: 10px;”
            closed=”true” buttons=”#dlg-buttons”>
            <div class=”ftitle”>
                付加物新闻</div>
            <form id=”form1″ runat=”server” method=”post”>
            <table id=”table_edit” class=”tab” style=”width: 98%;
    font-size: 12px; border: 1px #E1E1E1 solid” cellpadding=”0″
                cellspacing=”1″>
                <tr class=”tab_tr” style=”display: none;”>
                    <td colspan=”4″>
                        <input name=”ID” class=”easyui-validatebox”
    />
                        <input name=”MonadID” class=”easyui-validatebox”
    />
                    </td>
                </tr>
                <tr style=”height: 26px;” class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        商品名称:
                    </td>
                    <td class=”tab_td_left”>
                        <input name=”Name” class=”easyui-validatebox”
    required=”true” style=”width:150px” />
                    </td>
                    <td class=”tab_td_right” style=”width:80px;”>
                        商品系列:
                    </td>
                    <td class=”tab_td_left”>
                        <input id=”TypeID” name=”TypeID” style=”width:
    200px” required=”true” />
                    </td>
                </tr>
                <tr style=”height: 26px; ”  class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        商品价位:
                    </td>
                    <td class=”tab_td_left”>
                        <input name=”Price” class=”easyui-validatebox”
    required=”true” style=”width: 150px” />
                    </td>
                    <td class=”tab_td_right” style=”width:80px;”>
                        商品折扣:
                    </td>
                    <td class=”tab_td_left”>
                        <input id=”Discount” name=”Discount”
    style=”width: 200px” />
                    </td>
                </tr>
                <tr style=”height: 26px; ”  class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        仓库储存数据:
                    </td>
                    <td class=”tab_td_left”>
                        <input id=”InventoryNumber”
    name=”InventoryNumber” style=”width: 150px” />
                    </td>
                    <td class=”tab_td_right” style=”width:80px;”>
                        卖出件数:
                    </td>
                    <td class=”tab_td_left”>
                        <input id=”SellNumber” name=”SellNumber”
    style=”width: 200px” />
                    </td>
                </tr>
                <tr style=”height: 26px; ”  class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        状       态:
                    </td>
                    <td class=”tab_td_left”>
                        上架<input name=”Flag” type=”radio” value=”0″
    />&nbsp&nbsp&nbsp
                        下架<input name=”Flag” type=”radio” value=”1″
    />
                    </td>
                    <td class=”tab_td_right” style=”width:80px;”>
                       是或不是销路广:
                    </td>
                    <td class=”tab_td_left”>
                        正常<input name=”IsHotSell” type=”radio”
    value=”0″ />&nbsp&nbsp&nbsp
                        热销<input name=”IsHotSell” type=”radio”
    value=”1″ />
                    </td>
                </tr>
                <tr style=”height: 26px; ”  class=”tab_tr”
    id=”trSeckill”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        秒杀状态:
                    </td>
                    <td class=”tab_td_left” >
                        正常<input name=”IsSeckill” type=”radio”
    value=”0″  onclick=”DisDate()”/>&nbsp&nbsp&nbsp
                        秒杀<input name=”IsSeckill” type=”radio”
    value=”1″  onclick=”HideDate()”/>
                    </td>
                    <%– <td class=”tab_td_left” >
                    <input id=”SeckillDateBegin” disabled=”disabled”
    class=”easyui-datetimebox” name=”SeckillDateBegin”
    data-options=”required:true,showSeconds:false” 
    style=”width:150px”> 
                   至<input id=”SeckillDateEnd” disabled=”disabled”
    class=”easyui-datetimebox” name=”SeckillDateEnd”
    data-options=”required:true,showSeconds:false” 
    style=”width:150px”>
                    </td>–%>
                </tr>
                <tr style=”height: 26px; ”  class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        成品照片:
                    </td>
                    <td class=”tab_td_left” colspan=”3″>
                        <div>
                            <asp:TextBox ID=”FilePath” name=”FilePath”
    runat=”server” CssClass=”txtInput normal left”
                                MaxLength=”255″></asp:TextBox>
                            <a href=”javascript:;” class=”files”>
                                <input type=”file” id=”FileUpload”
    name=”FileUpload” onchange=”Upload(‘SingleFile’, ‘FilePath’,
    ‘FileUpload’);” /></a>
                            <span
    class=”uploading”>正在上传,请稍候…</span>
                        </div>
                    </td>
                </tr>
                <tr style=”height: 26px;”  class=”tab_tr”>
                    <td class=”tab_td_right” style=”width:80px;”>
                        描       述:
                    </td>
                    <td class=”tab_td_left” colspan=”3″>
                        <textarea id=”Describe” name=”Describe”
    style=”width: 99%; height: 100px; visibility: hidden;”
                            runat=”server”></textarea>
                    </td>
                </tr>
            </table>
            </form>
        </div>
        <div id=”dlg-buttons”>
            <a href=”javascript:void(0)” class=”easyui-linkbutton”
    iconcls=”icon-ok” onclick=”Save()”>
                保存</a> <a href=”javascript:void(0)”
    class=”easyui-linkbutton” iconcls=”icon-cancel”
                   
    onclick=”javascript:$(‘#dlg’).dialog(‘close’)”>取消</a>
        </div>
    </body>

上述正是本文的全部内容了,希望我们能够赏识。

代码很简单,达成的作用也很简短,有亟待的小友人仿照效法下啊。 复制代码
代码如下: head runat=”server” title…

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图