二级联动

Posted xiaxinxin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了二级联动相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- 引入jquery开发包 -->
<script type="text/javascript" src="../libs/jquery-1.11.0.min.js"></script>
<meta http-equiv="content-type" content="textml; charset=UTF-8">
<script type="text/javascript">
//页面加载完成
$(function(){
$("#addBtn").click(function(){

var num =0;

num=num+1;
var name = $("#name").val();
var types = $("#types").val();
var prices = $("#prices").val();
var nums = $("#nums").val();

//在这里边进行判断的操作

if(name==null || name=="" || prices<0 || prices==null || prices==""){
alert("用户名和价钱不能小于0");
}else{
var tr = $("<tr><td>"+num+"</td><td>"+name+"</td><td>"+prices+"</td><td>"+nums+"</td><td>"+types+"</td><td>"+prices+"</td><td><button onclick=‘clikc1(this)‘>删除</button></td></tr>");
$("table").append(tr);
}


});

});


function clikc1(a){

alert("确定要删除商品吗")
$(a).parent().parent().remove();
}
//var tr = $("<tr><td>"+name+"</td><td>"+email+"</td><td>"+phone+"</td><td><a href=‘#‘ onclick=‘deleteItem(this);‘>删除</a></td></tr>");

</script>
</head>

<body>
<div>
<form>
商品名称 <input type="text" name="name" id="name"/>
类型<input type="text" name="types" id="types"/>
价格 <input type="number" name="prices" id="prices"/>
数量 <input type="text" name="nums" id="nums"/>
<input type="button" value="添加" id="addBtn" /><br><!--[if IE]>

<![endif]-->
</form>
<hr/>
<table border="1">
<tr>
<th>商品序号</th>
<th>商品名称</th>
<th>商品价格</th>
<th>商品数量</th>

<th>商品类别</th>
<th>小计</th>
<th>操作</th>
</tr>

</table>


<h3>总价钱:</h3>
</div>
</body>
<ml>

以上是关于二级联动的主要内容,如果未能解决你的问题,请参考以下文章

asp 下拉框 二级联动

asp 下拉菜单的二级联动

《JeecgBoot系列》 如何设计表单实现“下拉组件二级联动“ ? 以省市二级联动为例

二级联动列表

phpcms联动菜单有啥用

二级联动