//是否公共,可直接修改是否为是否,其它值保持不变
var ispbId = $("tr #ispbTD");
ispbId.each(function(){
if($.trim($(this).text())=='否') $(this).css("cursor","pointer").css("color","blue");
else $(this).css("cursor","pointer").css("color","red");
});
ispbId.click(function(){
var tdObj = $(this);
if(tdObj.children("input").length > 0){
return false;
}
var text = $.trim(tdObj.html());
var bugID = tdObj.attr("title");
tdObj.html("");
var inputObj = $("<input type='text' name='ispb' id='ispb' />")
.css("border-width","0").attr("maxlength","10")
.width(tdObj.width()).height(tdObj.height())
.val(text).appendTo(tdObj);
inputObj.trigger("focus").trigger("select");
inputObj.click(function(){
return false;
});
inputObj.keypress(function(event){
event = event ? event : window.event;
var keycode = event.which ? event.which : event.keyCode;
if(keycode == 13)
{
tdObj.html($(this).val());
if($(this).val()=='是') var valispb = '1';
else if($(this).val()=='否') var valispb = '0';
else var valispb = null;
var link = createLink('bug', 'ajaxEditField', 'bugID=' + bugID + '&fieldName=ispb&fieldValue=' + valispb);
if(valispb!==null)$(this).load(link);
else tdObj.html(text);
if(tdObj.text()=='否') tdObj.css("color","blue");
else if(tdObj.text()=='是') tdObj.css("color","red");
}
if(keycode == 27)
{
tdObj.html(text);
}
});
inputObj.blur(function(){
tdObj.html(text);
});
});