?? itemtype.js
字號:
function show_itemtype(){
obj = document.getElementById('itemtype');
if (!obj){
return;
}
if(obj.style.display == ""){
obj.style.display ='none';
}else{
obj2 = GE("itemtype_button");
obj.style.top = findPosY(obj2)+20;
obj.style.left = findPosX(obj2);
obj.style.display = "";
}
}
function add_itemtype(){
name = GE("typename").value;
order = GE("typeorder").value;
if(name){
var url = user_file + "?action=itemtype&job=add&type=" + itemtype;
var param = "typename=" + ajax_convert(name) + '&order=' + ajax_convert(order);
send_request(url,add_itemtype_response,param);
}else{
alert('分類名稱不能為空!');
}
}
function add_itemtype_response(){
var typeid;
typeid = http_request.responseText;
if(!typeid){
return;
}
_typename = GE("typename").value;
_typeorder = GE("typeorder").value;
GE("typename").value = '';
GE("typeorder").value = '';
obj = GE("itemtype_list");
tb_row = document.createElement("tr");
tb_row.id = 'itemtype_' + typeid
obj.appendChild(tb_row);
tb_cell = document.createElement("td");
tb_cell.align='center';
tb_row.appendChild(tb_cell);
input = document.createElement('input');
input.id = 'typename_' + typeid;
input.type = 'text';
input.size = 15;
input.className ='input';
input.maxLength = 50;
input.value = _typename;
tb_cell.appendChild(input);
tb_cell = document.createElement("td");
tb_cell.innerHTML =
'<input type="text" size="5" class="input" id="typeorder_' + typeid + '" value="' + _typeorder + '"> ' +
'<a href="javascript:" onclick="edit_itemtype(' + typeid + ')" onmouseover="this.style.textDecoration=\'underline\';" onmouseout="this.style.textDecoration=\'none\';">修改</a>'+
' <a href="javascript:" onclick="del_itemtype(' + typeid + ')" onmouseover="this.style.textDecoration=\'underline\';" onmouseout="this.style.textDecoration=\'none\';">刪除</a>';
tb_row.appendChild(tb_cell);
op = document.createElement("option");
op.id = 'itemtype_op_' + typeid;
op.appendChild(document.createTextNode(_typename));
op.value = typeid;
GE("itemtype_select").appendChild(op);
}
function edit_itemtype(id){
newname = GE('typename_' + id).value;
neworder = GE('typeorder_' + id).value;
if(!newname){
alert('分類名稱不能為空!');
return;
}
var url = user_file + "?action=itemtype&job=edit&type=" + itemtype + "&typeid=" + id;
var param = "newname=" + ajax_convert(newname) + '&neworder=' + ajax_convert(neworder);
send_request(url,edit_itemtype_response,param);
}
function edit_itemtype_response(){
id = http_request.responseText;
if(id){
GE('itemtype_op_' + id).text=GE('typename_' + id).value;
alert('分類編輯成功!');
} else {
alert('分類編輯失敗!');
}
}
function del_itemtype(id){
if(confirm('您確認要刪除此分類?')){
var url = user_file + "?action=itemtype&job=del&type=" + itemtype + "&typeid=" + id;
var param = "";
send_request(url,del_itemtype_response,param);
}
}
function del_itemtype_response(){
id = http_request.responseText;
if(id){
GE("itemtype_list").removeChild(GE('itemtype_' + id));
GE("itemtype_select").removeChild(GE('itemtype_op_' + id));
}else{
alert('分類刪除失敗!');
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -