📄 stufflist.aspx
字号:
selectSltValue(document.all("sltNewCategory"),vbTrim(currentTR.cells[6].outerText));
//给控件赋值
document.all("txtId").value=vbTrim(currentTR.cells[0].outerText);
document.all("txtNewStuffNo").value=vbTrim(currentTR.cells[1].outerText);
document.all("txtNewStuffName").value=vbTrim(currentTR.cells[2].outerText);
document.all("txtNewSpecification").value=vbTrim(currentTR.cells[3].outerText);
//document.all("txtNewStuffType").value=vbTrim(currentTR.cells[6].outerText);
//document.all("txtNewUnit").value=vbTrim(currentTR.cells[4].outerText);
document.all("txtNewPrice").value=vbTrim(currentTR.cells[7].outerText);
document.all("txtNewStock").value=vbTrim(currentTR.cells[8].outerText);
document.all("txtNewNote").value=vbTrim(currentTR.cells[10].outerText);
showDiv(document.all("popDiv"));
}
function newRecord(div)
{
userOperate="add";
BindUnit(document.all("sltNewUnit"));
document.all("txtId").value=999;
document.all("txtNewStuffNo").value="";
document.all("txtNewStuffName").value="";
document.all("txtNewSpecification").value="";
//document.all("txtNewStuffType").value="";
//document.all("txtNewUnit").value="";
document.all("txtNewPrice").value="";
document.all("txtNewStock").value="";
document.all("txtNewNote").value="";
showDiv(div);
}
function delRecord()
{
userOperate="del";
if(currentTR==null)
{
alert("请先选择要修改的");
return;
}
if(confirm("记录删除后将不能恢复,确定删除记录吗?"))
{
document.all("txtId").value=vbTrim(currentTR.cells[0].outerText);
save2(document.all("tb1"));
}
}
</script>
<script language=vbscript>
titleResize
'剪切函数
function vbTrim(str)
vbTrim=trim(str)
end function
sub validate(byval retValue,byref isAvailable,byref msg)
tmp=split(retValue,"|")
isAvailable=tmp(0)
msg=tmp(1)
end sub
</script>
<script language="javascript">
//添加事件处理
var userOperate;
function addMoveEvent(obj)
{
obj.attachEvent("onmouseover",function(){RowMouseOver(obj);});
}
function addOutEvent(obj)
{
obj.attachEvent("onmouseout",function(){RowMouseOut(obj);});
}
function addClickEvent(obj)
{
obj.attachEvent("onclick",function(){chooseTr(obj);});
}
function addDblClickEvent(obj)
{
obj.attachEvent("ondblclick",function(){modifyRecord();});
}
function save2(tb1)
{
var param="";
var IsAvailable,msg;
var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
if(userOperate=="del")
{
param="op=del&id="+document.all("txtId").value;
}
else if(userOperate=="modify")
{
param="op=modify&id="+document.all("txtId").value+"&sno="+document.all("txtNewStuffNo").value+"&sname="+document.all("txtNewStuffName").value+"&spec="+document.all("txtNewSpecification").value+"&unit="+document.all("sltNewUnit").options[document.all("sltNewUnit").selectedIndex].outerText+"&stype="+document.all("sltNewCategory").value+"&price="+document.all("txtNewPrice").value+"&stock="+document.all("txtNewStock").value+"&sort="+document.all("sltNewSort").value+"&remark="+document.all("txtNewNote").value+"";
}
else
{
param="op=add&id="+document.all("txtId").value+"&sno="+document.all("txtNewStuffNo").value+"&sname="+document.all("txtNewStuffName").value+"&spec="+document.all("txtNewSpecification").value+"&unit="+document.all("sltNewUnit").options[document.all("sltNewUnit").selectedIndex].outerText+"&stype="+document.all("sltNewCategory").value+"&price="+document.all("txtNewPrice").value+"&stock="+document.all("txtNewStock").value+"&sort="+document.all("sltNewSort").value+"&remark="+document.all("txtNewNote").value+"";
}
xmlHttp.open("POST","StuffHandle.aspx",false);
xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
xmlHttp.send(param);
var retValue=xmlHttp.responsetext;
if(getState(retValue)=="1")//添加成功
{
if(userOperate=="add")//更新界面
{
var row=tb1.insertRow(tb1.rows.length);
row.style.height="22";
row.style.whiteSpace="nowrap";
row.style.backgroundColor="#ffffff";
addMoveEvent(row);
addOutEvent(row);
addClickEvent(row);
addDblClickEvent(row);
var cell=row.insertCell();
cell.className="td1";
cell.innerText=getMsg(retValue);
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewStuffNo").value;
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewStuffName").value+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewSpecification").value+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("sltNewUnit").options[document.all("sltNewUnit").selectedIndex].outerText+" ";
cell=row.insertCell();
cell.className="td1";
//cell.style.display="none";
cell.style.width="0"
cell.innerText=document.all("sltNewCategory").value+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("sltNewCategory").options[document.all("sltNewCategory").selectedIndex].outerText+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewPrice").value+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewStock").value+" ";
cell=row.insertCell();
cell.className="td1";
//cell.style.display="none";
cell.style.width="0";
cell.innerText=document.all("sltNewSort").value+" ";
cell=row.insertCell();
cell.className="td1";
cell.innerText=document.all("txtNewNote").value+" ";
document.all("popDiv").style.display="none";
alert("添加成功!");
}
else if(userOperate=="modify")
{
currentTR.cells[1].innerText=document.all("txtNewStuffNo").value;
currentTR.cells[2].innerText=document.all("txtNewStuffName").value;
currentTR.cells[3].innerText=document.all("txtNewSpecification").value;
currentTR.cells[4].innerText=document.all("sltNewUnit").options[document.all("sltNewUnit").selectedIndex].outerText;
currentTR.cells[5].innerText=document.all("sltNewCategory").value;
currentTR.cells[6].innerText=document.all("sltNewCategory").options[document.all("sltNewCategory").selectedIndex].outerText+" "
currentTR.cells[7].innerText=document.all("txtNewPrice").value;
currentTR.cells[8].innerText=document.all("txtNewStock").value;
currentTR.cells[9].innerText=document.all("sltNewSort").value;
currentTR.cells[10].innerText=document.all("txtNewNote").value;
document.all("popDiv").style.display="none";
alert("更新成功");
}
else
{
var obj;
var obj2=currentTR;
if((obj=currentTR.nextSibling)!=null)
{
currentTR=obj;
}
else
{
if((obj=currentTR.previousSibling)!=null)
{
currentTR=obj;
}
else
{
currentTR=null;
}
}
tb1.deleteRow(obj2.rowIndex);
if(currentTR!=null)
{
chooseTr(currentTR);
}
alert("删除成功!");
}
document.all("popDiv").style.display="none";
}
else
{
alert(getMsg(retValue));
}
}
function save(op)
{
alert("abc");
return;
var param="";
var IsAvailable,msg;
var xmlHttp=new ActiveXObject("microsoft.XMLHTTP");
if(op!="del")
{
if(document.all("txtId").value=="")
{
param="op=add&unit="+document.all("txtUnit").value+"¬e="+document.all("txtNote").value;
}
else
{
param="op=modify&unit="+document.all("txtUnit").value+"¬e="+document.all("txtNote").value+"&id="+document.all("txtId").value.toString();
}
}
else
{
param="op=del&id="+document.all("txtId").value;
}
xmlHttp.open("POST","UnitHandle.aspx",false);
xmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;");
xmlHttp.send(param);
var responseValue=xmlHttp.responsetext;
if(getState(responseValue)=="0")
{
alert(getMsg(responseValue));
return;
}
if(op!="del")
{
if(document.all("txtId").value=="")
{
var row=tb1.insertRow(tb1.rows.length);
row.style.height="22";
row.style.whiteSpace="nowrap";
row.style.backgroundColor="#ffffff";
addMoveEvent(row);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -