js属性控件

  前端用于增加、修改、删除属性的简易控件,实现对事物的属性进行增删改的功能。可添加新增修改事件实现对数据的验证。有两种属性控件(输入框与属性框)

Sh_property(pro)

_obj

对象

_key

标签id

_myTag

容器

_proType

类型(0默认输入框 1属性框)

_dTxt

默认值

_index

索引位置

_readonly

是否只读

html代码

<head>

    <title></title>

    <link href="/_css/manage.css" rel="stylesheet" type="text/css" />

    <script src="/_js/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script src="/_js/Sh_property.js" type="text/javascript"></script>

    <script src="download.js" type="text/javascript"></script>

</head>

<body>

    <div class="content">

    </div>

</body>

fun_update(obj)

传递该方法可以添加新增或修改属性时执行的操作,如:增加修改属性时一些验证操作等。

参数:

  • obj:对象

示例1:

new Sh_property({ myTag: $('.con .content'),
   proType: 0,
   index: 0,
   defaultTxt: '类型名称',
   key: 0,
   value: "",
   fun_update: function (obj) {
      alert("新增或修改操作");
   }
});

展示效果:

示例2:

new Sh_property({ myTag: $('.con .content'),
   proType: 1,
   index: index,
   defaultTxt:'请输入属性名称:值',
   value: '请输入属性名称:值',
   fun_update: function (obj) {
      alert("新增或修改操作");
   }
});

展示效果:

fun_info_del(_id, _title)

删除属性时执行的方法。

示例1:

new Sh_property({ myTag: $('.con .content'),
   proType: 0,
   index: 0,
   defaultTxt: '类型名称',
   key: 0,
   value: "",
   fun_info_del: function (obj) {
      alert("删除事件");
   }
});

展示效果:

示例2:

new Sh_property({ myTag: $('.con .content'),
   proType: 1,
   index: index,
   defaultTxt:'请输入属性名称:值',
   value: '请输入属性名称:值',
   fun_info_del: function (obj) {
      alert("删除事件");
   }
});

展示效果:

下载地址:

js属性控件

http://www.tiaoceng.com/assemblydetail_31.html

posted @ 2016-06-20 13:07  跳层  阅读(1111)  评论(0编辑  收藏  举报