首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

YUI式样的一点心得

2012-10-29 
YUI样式的一点心得%@ page languagejava importjava.util.Date contentTypetext/html charsetU

YUI样式的一点心得
<%@ page language="java" import="java.util.Date" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>  
<%@include file="/public/jsp/init.jsp"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath}/public/ui/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/public/ui/yui/connection/connection-min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> 
<title>小姐维护</title>
<p:jsLib>
{<c:out escapeXml="false" value="${uiLibs}"/>,
components:['PORTAL.widget.form',
'PORTAL.widget.datatable',
'PORTAL.widget.button',
'PORTAL.widget.container','connection']}
</p:jsLib>
<Script language="javaScript">
PORTAL.namespace("page");
var D = PORTAL.widget.DialogFactory;

//页面初始化
YAHOO.util.Event.onDOMReady(function(){
});

//外部接口
(function(){
PORTAL.page.interface = {
hiddenDialog:function(){
D.get('dialog1').hide();
},
//tmpObj,用于记录iframe 中的dataTable 对象
tmpObj:{},
setItemValue:function(rs){
var obj = PORTAL.page.interface.tmpObj;
obj.datatable.updateCell(obj.record,"itemName",rs.getData("name"));
        obj.datatable.updateCell(obj.record,"itemVersion",rs.getData("ecn"));
        D.get('vendorItemDialog').hide();
}
};

})();

//页面业务类
(function(){
PORTAL.page.bussiness={
//处理返回成功的函数
handleSuccess:function(o) {
if (o.responseText !== undefined) {
var result=eval("("+o.responseText+")");
alert(o.responseText);
}
},
handleFailure:function(o) {
//处理失败的函数
if (o.responseText !== undefined) {
alert("HTTP状态: " + o.status);
alert("HTTP状态代码的信息: " + o.statusText);
}
},
doSave:function(){//新增保存方法

alert('提交');
//回调函数
var callback = {
success:function(o){
var status = YAHOO.lang.JSON.parse(o.responseText);
        if(!status.status){       
        alert("×错误!(请选择正确选项)");
        YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","block");
window.setTimeout(function(){
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","none");
},3000);
        }else{
alert("√保存成功!");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","block");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","none");
window.setTimeout(function(){
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","none");
},3000);
}
},failure: function(o) {
            alert(o.responseText);
            YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","block");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","none");
window.setTimeout(function(){
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","none");
},3000);
            }
};
var id = document.getElementById("Pid").value;
var no = document.getElementById("vendorNo").value;
var name = document.getElementById("vendorname").value;
var canBeConsumed = document.getElementById("canBeConsumed").checked;
var canBeReceived = document.getElementById("canBeReceived").checked;
var desc = document.getElementById("desc").value;
var sUrl= PORTAL.constant.CONTEXT_PATH +"/views/masterData/vendor/vendorMaintenanceAction!doSave.action";
var postData="Pid="+id+"&vendorNo="+no+"&vendorname="+name+"&canBeConsumed="+canBeConsumed+"&canBeReceived="+canBeReceived+"&desc="+desc;
alert(postData);
var request = YAHOO.util.Connect.asyncRequest("POST",sUrl,callback, postData);
},
canBeConsumedValue:function (){// 可接受人员alert("select");
var obj = document.getElementById("selectCanBeConsumed");
var index = obj.selectedIndex; // 选中索引
var value = obj.options[index].value; // 选中值
if(value!=null){
document.getElementById("canBeConsumed").value=value;
}else{
document.getElementById("canBeConsumed").value=" ";
}
},
canBeReceivedValue:function (){//可消人员alert("select1");
var obj = document.getElementById("selectCanBeReceived");
alert(obj);
var index = obj.selectedIndex; // 选中索引
alert(index);
var value = obj.options[index].value; // 选中值
if(value!=null){
document.getElementById("canBeReceived").value=value;
}else{
document.getElementById("canBeReceived").value=" ";
}
},
getVendorDetail:function (){//得到单个客户
//回调函数
var callback = {
success:function(o){
var status = YAHOO.lang.JSON.parse(o.responseText);
        if(!status.status){       
        alert("×错误!(改小姐不存在!请重新输入!)");
        YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","block");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","none");
window.setTimeout(function(){
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","none");
},3000);
        }else{
        YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","block");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("errorMes"),"display","none");
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("excepMes"),"display","none");
window.setTimeout(function(){
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("succeMes"),"display","none");
},3000);
        YAHOO.util.Dom.get("vendorNo").value=status.result.no;
YAHOO.util.Dom.get("vendorname").value=status.result.name;
YAHOO.util.Dom.get("canBeConsumed").value=status.result.canBeConsumed;
YAHOO.util.Dom.get("canBeReceived").value=status.result.canBeReceived;
YAHOO.util.Dom.get("desc").value=status.result.desc;
YAHOO.util.Dom.get("createUser").value=status.result.createUser.id;
YAHOO.util.Dom.get("createDate").value=status.result.createDate;
YAHOO.util.Dom.get("modifyUser").value=status.result.modifyUser.id;
YAHOO.util.Dom.get("modifyDate").value=status.result.modifyDate;
}
},failure: function(o) {
            alert(o.responseText);
            }//处理成功对应的函数
};
alert("fdsfdsfsfds");
var no = document.getElementById("vendorNo").value;
alert("jagdjhfjsdhgf");
var postData = "vendorNO="+no;
alert("====================="+no);
var sUrl= PORTAL.constant.CONTEXT_PATH +"/views/masterData/vendor/vendorMaintenance/vendorMaintenanceAction!getVendorDetail.action";
alert(sUrl);

try{
var request = YAHOO.util.Connect.asyncRequest("POST",sUrl,callback, postData);
}catch(ex){alert(ex.message);}
},
find:function(){//模糊查询
//回调函数
var callback = {
success:function(o){
var status = YAHOO.lang.JSON.parse(o.responseText);
        if(!status.status){       
        alert("×错误!(请选择正确选项)");
        }else{
alert("√查询成功!");
}
},failure: function(o) {
            alert(o.responseText);
            }//处理成功对应的函数
};
var vendorName = document.getElementById("vendorname").value;
var vendorNo = document.getElementById("vendorNo").value;
var postData = "vendorname="+vendorName+"&vendorNo="+vendorNo;
alert("fddddddd");
var path= PORTAL.constant.CONTEXT_PATH+"/views/masterData/vendor/vendorMaintenance/vendorList.jsp?vendorNo="+vendorNo+"&vendorname="+vendorName;
var panel = D.show("dialog1", 
            { fixedcenter : true,
              visible : true, 
              constraintoviewport : true,
              header:"供应商列表",
              body:"<iframe frameborder=0 width='500px' height='350px' src='"+path+"'></iframe>",
              buttons : [ 
                          { text:"取消", handler:function(){
this.hide();
}}]
             } );
},
setFormValue:function(obj){//给表单赋值
YAHOO.util.Dom.get("vendorNo").value=obj.getData("no");
alert(YAHOO.util.Dom.get("vendorNo").value);
YAHOO.util.Dom.get("vendorname").value=obj.getData("name");
YAHOO.util.Dom.get("desc").value=obj.getData("desc");
YAHOO.util.Dom.get("canBeConsumed ").value=obj.getData("canBeConsumed");
YAHOO.util.Dom.get("canBeReceived").value=obj.getData("canBeReceived");
YAHOO.util.Dom.get("createUser").value=obj.getData("createUser").id;
YAHOO.util.Dom.get("createDate").value=obj.getData("createDate");
YAHOO.util.Dom.get("modifyUser").value=obj.getData("modifyUser").id;
YAHOO.util.Dom.get("modifyDate").value=obj.getData("modifyDate");
YAHOO.util.Dom.get("Pid").value=obj.getData("Pid");
},
showAddItemWin:function(){

var path= PORTAL.constant.CONTEXT_PATH+"/views/masterData/vendor/vendorMaintenance/item.jsp";
var panel2 = D.show("dialog2", 
            { fixedcenter : true,
              visible : true, 
              constraintoviewport : true,
              header:"物料明细",
              body:"<iframe frameborder=0 width='500px' height='350px' src='"+path+"'></iframe>",
              buttons : [ 
                          { text:"取消", handler:function(){
this.hide();
}}]
             } );
}
};
})();

</Script>
</head>


<body onload="setTab('two',2,7 ,'jt',1,2)" cellspacing="0" summary="">
<%session.setAttribute("site","BYD-mes");%>
  <tr>
    <th scope="row"  tabIndex="2"  type="text"  name="no" id="vendorNo"/>
<input type="button" name="select" title="查询"   value=""
onclick="PORTAL.page.bussiness.find()" />
<input name="ss" type="button" value="检索" onclick="PORTAL.page.bussiness.getVendorDetail()"/>
<input name="abc" type="reset" />
</td>
  </tr> 
</table>
            </div>
<!--
<div >×异常!(请选择正确选项)</div>            
<div >×错误!(请选择正确选项)</div>   
-->
<div id="jt1" onClick="setTab('jt',1,2)">基本信息</li>
    <li id="jt2" onClick="setTab('jt',2,2)">明细</li>
</ul>
</div>
</div>
</div>
</div>
<div cellspacing="0" summary="">
<tr>
<th colspan="2" scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="row" method="post">
<table id="mytable" cellspacing="0" summary="">
<caption>详细信息</caption>
   <tr>
    <th colspan="2" scope="col"  >&nbsp;</th>
  </tr>
  <tr>
    <th scope="row"  tabIndex="2" type="text"  name="vv" id="vendorname"/>
</td>
  </tr>
  <tr>
    <th scope="row"  tabIndex="2" type="text"   name="hh" id="desc"/>
</td>
  </tr>
  <tr>
    <th scope="row"   id="canBeConsumed" type="checkbox" />
    </td>
  </tr>
  <tr>
    <th scope="row"  id="canBeReceived" type="checkbox"  />
</td>
  </tr>
<tr>
<th scope="col"></th>
<th scope="col"><input name="" type="button"
onclick="PORTAL.page.bussiness.doSave()" /> <input name="" type="reset" /></th>
</tr>

   
 
</table>
   <input type="hidden" name="pid" id="Pid" >
</form>
</div>



<div id="con_jt_2" style="display: none">
<div height="100%" marginheight=0 marginwidth=0 src="vendorItem.jsp" ></iframe>
          </div>
        </div>
  </div>
</div>
</div>  
   
</div>   
         
        </div>
    </div>     
<jsp:include page="/views/fragment/right.jsp"/>     
      <!--comm_right-->
    </div> 
<jsp:include page="/views/fragment/footer.jsp"/>
</div>
</div>
</body>
</html>

热点排行