日期:2014-05-16  浏览次数:20482 次

javascript 可编辑表格问题
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
<style   type= "text/css ">
.select{border:medium;   border-style:solid;   border-width:thick;}
</style>
</head>

<body>

<script   language= "javascript ">
var   thisid;
var   text;

function   inputtext(obj){
thisid=document.getElementById(obj);
text=thisid.innerText;
thisid.innerHTML= " <input   id=t   type= 'text '     onblur= 'backchange() '   name= 'textfield '   style= 'width:100%;height:28px;border:1px   solid   #CCCCFF;line-height:28px;   font-family:   宋体;   color:   #000000;   font-size:   16pt '   /> ";
document.all.t.value=text;
document.all.t.focus();
}

function   backchange(){
text=document.all.t.value;
thisid.innerHTML=text;
}

function   selected(objs){
theId=document.getElementById(objs);
theId.class= "select ";
//theId.style.background= "#fff000 ";
//theId.style.border=solid;  
//theId.style.border-color=#999999;  
//theId.style.border-style=solid;  
//theId.style.border-width=2px;
//theId.style.border-width= "3 ";


}

</script>
<br   />
<br   /> <br   /> <br   />

<table     name= "text "   id= "text "   width= "100% "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
    <tr>
        <td   height= "30 "   width= "30% "   id= "11 "   bgcolor= "#00FF66 "   onclick= "selected( '11 ') "   ondblclick= "inputtext( '11 '); "> &nbsp; </td>
        <td   height= "30 "   width= "30% "   id= "12 "   bgcolor= "#00FF66 "   onclick= "selected( '12 ') "   ondblclick= "inputtext( '12 '); "> &nbsp; </td>
        <td   height= "30 "   width= "40% "   id= "13 "   bgcolor= "#00FF66 "   onclick= "selected( '13 ') "   ondblclick= "inputtext( '13 '); "> &nbsp; </td>
    </tr>
    <tr>
        <td   height= "30 "   width= "30% "   id= "21 "   bgcolor= "#00FF66 "   ondblclick= "inputtext( '21 '); "> &nbsp; </td>
        <td   height= "30 "   width= "30% "   id= "22 "   bgcolor= "#00FF66 "   ondblclick= "inputtext( '22 '); "> &nbsp; </td>
        <td   height= "30 &qu