| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
- <xhtml:head>
- <xhtml:title>我的测试</xhtml:title>
- <model id="model1">
- <instance id="instance1">
- <root xmlns="">
- <formData>
- <id/>
- <name/>
- <birthday/>
- <address/>
- <phone/>
- <email/>
- </formData>
- <resData/>
- <reqData/>
- <gridData>
- </gridData>
- </root>
- </instance>
- </model>
- <script type="javascript" src="../../js/boaMsg.js"/>
- <script type="javascript" src="../../js/boaCommon.js"/>
- <script type="javascript" src="../../js/dCommon.js"/>
- <script type="javascript">
- <![CDATA[
- function click()
- {
- var str=model.getValue("/root/formData/id");
- if(str=="")
- find();
- else
- find1();
- }
-
- function find()
- {
- model.reset();
- //alert("Hello");
- datagrid1.nodeset="/root/gridData/ResultList1_Row";
- commSubmit("UID020050-service","find","glueAction.do");
- model.copyNode("/root/gridData","/root/resData/ResultList1_VO");
- model.refresh();
- }
-
- function find1()
- {
- //alert("World");
- model.removenode("/root/reqData");
- datagrid1.nodeset="/root/gridData/ResultList2_Row";
- model.makeValue("/root/reqData/id",model.getValue("/root/formData/id"));
- commSubmit("UID020050-service","find1","glueAction.do");
- model.copyNode("/root/gridData","/root/resData/ResultList2_VO");
- model.refresh();
- }
-
- function insert()
- {
- var id=model.getValue("/root/formData/id");
- var name=model.getValue("/root/formData/name");
- var birthday=model.getValue("/root/formData/birthday");
- var address=model.getValue("/root/formData/address");
- var phone=model.getValue("/root/formData/phone");
- var email=model.getValue("/root/formData/email");
- if(id==""||name==""||birthday==""||address=="",phone=="",email=="")
- alert("请输入数据");
- model.removenode("/root/reqData");
- model.makeValue("/root/reqData/id",id);
- model.makeValue("/root/reqData/name", name);
- model.makeValue("/root/reqData/birthday", birthday);
- model.makeValue("/root/reqData/address", address);
- model.makeValue("/root/reqData/phone",phone);
- model.makeValue("/root/reqData/email",email);
- commSubmit("UID020050-service","insert","glueAction.do");
- alert("数据插入成功");
- model.reset();
- find();
- model.refresh();
- }
-
- function update()
- {
- var id=model.getValue("/root/formData/id");
- var name=model.getValue("/root/formData/name");
- var birthday=model.getValue("/root/formData/birthday");
- var address=model.getValue("/root/formData/address");
- var phone=model.getValue("/root/formData/phone");
- var email=model.getValue("/root/formData/email");
- if(id==""||name==""||birthday==""||address=="",phone=="",email=="")
- alert("请输入数据");
- model.removenode("/root/reqData");
- model.makeValue("/root/reqData/id", id);
- model.makeValue("/root/reqData/name", name);
- model.makeValue("/root/reqData/birthday", birthday);
- model.makeValue("/root/reqData/address", address);
- model.makeValue("/root/reqData/phone",phone);
- model.makeValue("/root/reqData/email",email);
- commSubmit("UID020050-service","update","glueAction.do");
- alert("数据更新成功");
- model.reset();
- find();
- model.refresh();
- }
-
- function deleteData()
- {
- var id=input1.value;
- //alert(id);
- if(id=="")
- {
- window.alert("请输入你要删除的数据ID或者选择一条你要删除的数据","提示");
- return;
- }
-
- model.removenode("/root/reqData");
- model.makeValue("/root/reqData/id", id);
- commSubmit("UID020050-service","deleteData","glueAction.do");
- alert("数据删除成功");
- model.reset();
- find();
- model.refresh();
- }
- ]]>
- </script>
- </xhtml:head>
- <xhtml:body guideline="1366;1400;">
- <input id="input1" ref="/root/formData/id" style="left:55px; top:30px; width:165px; height:30px; "/>
- <caption id="ID" style="left:15px; top:30px; width:35px; height:30px; vertical-align:middle; ">I D</caption>
- <caption id="caption1" style="left:240px; top:30px; width:40px; height:30px; vertical-align:middle; ">姓名</caption>
- <input id="input2" ref="/root/formData/name" style="left:290px; top:30px; width:170px; height:30px; "/>
- <caption id="caption2" style="left:470px; top:30px; width:50px; height:30px; vertical-align:middle; ">生日</caption>
- <input id="input3" ref="/root/formData/birthday" inputtype="date" style="left:500px; top:30px; width:170px; height:30px; "/>
- <caption id="caption3" style="left:240px; top:85px; width:40px; height:30px; vertical-align:middle; ">电话</caption>
- <caption id="caption4" style="left:470px; top:85px; width:50px; height:30px; vertical-align:middle; ">邮箱</caption>
- <input id="input4" ref="/root/formData/address" style="left:55px; top:85px; width:165px; height:30px; "/>
- <input id="input5" ref="/root/formData/phone" style="left:290px; top:85px; width:170px; height:30px; "/>
- <caption id="caption5" style="left:10px; top:85px; width:40px; height:30px; vertical-align:middle; ">地址</caption>
- <input id="input6" ref="/root/formData/email" style="left:500px; top:85px; width:170px; height:30px; "/>
- <button id="button1" style="left:700px; top:30px; width:50px; height:30px; ">
- <caption>查询</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- click();
- ]]>
- </script>
- </button>
- <button id="button2" style="left:775px; top:30px; width:50px; height:30px; ">
- <caption>添加</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- insert();
- ]]>
- </script>
- </button>
- <button id="button3" style="left:700px; top:85px; width:50px; height:30px; ">
- <caption>修改</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- update();
- ]]>
- </script>
- </button>
- <button id="button4" style="left:775px; top:85px; width:50px; height:30px; ">
- <caption>删除</caption>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- deleteData();
- ]]>
- </script>
- </button>
- <datagrid id="datagrid1" nodeset="/root/gridData" caption="ID^姓名^生日^地址^电话^邮箱" colsep="^" colwidth="100, 100, 100, 124, 100, 180" mergecellsfixedrows="bycolrec" rowsep="|" style="left:55px; top:140px; width:725px; height:240px; ">
- <col ref="ID" type="input"/>
- <col ref="NAME" type="input"/>
- <col ref="BIRTHDAY" type="inputdate"/>
- <col ref="ADDRESS" type="input"/>
- <col ref="PHONE" type="input"/>
- <col ref="EMAIL" type="input"/>
- <script type="javascript" ev:event="onclick">
- <![CDATA[
- var i=datagrid1.row;
- //alert(i);
- if(i==0)
- return;
- input1.value=datagrid1.valueMatrix(i,0);
- input2.value=datagrid1.valueMatrix(i,1);
- var birthday=datagrid1.valueMatrix(i,2);
- //alert(birthday);
- birthday=birthday.substr(0,10);
- var year=birthday.substr(0,4);
- var month=birthday.substr(5,2);
- var day=birthday.substr(8,2);
- birthday=year+month+day;
- //alert(birthday);
- input3.value=birthday;
- input4.value=datagrid1.valueMatrix(i,3);
- input5.value=datagrid1.valueMatrix(i,4);
- input6.value=datagrid1.valueMatrix(i,5);
- ]]>
- </script>
- </datagrid>
- </xhtml:body>
- </xhtml:html>
|