当我把鼠标放到表格中的某一单元格上,点击左建,从这个单元格象其它单元格拖(所拖过单元格视为选中单元格),当我松开左键后,会弹出一个输入框,让我在输入框信息。输入的信息写到所有拖过(即背选中的单元格中)。(就象google里的myaccout里的日历中鼠标的操作差不多)小弟初学,请给出代码,在线等。 以下是-当我把鼠标放到表格中的某一单元格上,点击左建,就能弹出一个输入框,让我在输入框中写信息。的代码。看能否有启发,探讨<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript" >
var tdcur=""; function enterstr(){
var td=document.getElementById(tdcur);
td.innerText=prompt("请输入","");
}
</script >
<style type="text/css" >
<!--
TD.Edit {
mouse: expression(
onmouseover=function(){this.style.background= "#CCCCCC "},
onmouseout=function(){if(tdcur!=this.id) this.style.background= " "},
onclick=function(){var tdPrev=document.getElementById(tdcur);if(tdPrev!=null)tdPrev.style.background= " ";tdcur=this.id;this.style.background= "#CCCCCC ";enterstr()}
)
}
-- >
</style >
<table border="1" >
<tr >
<td id=td1 width="30" height="30" class="Edit" > </td >
<td id=td2 width="30" height="30" class="Edit" > </td >
<td id=td3 width="30" height="30" class="Edit" > </td >
</tr >
<tr >
<td id=td4 width="30" height="30" class="Edit" > </td >
<td id=td5 width="30" height="30" class="Edit" > </td >
<td id=td6 width="30" height="30" class="Edit" > </td >
</tr >
<tr >
<td id=td7 width="30" height="30" class="Edit" > </td >
<td id=td8 width="30" height="30" class="Edit" > </td >
<td id=td9 width="30" height="30" class="Edit" > </td >
</tr >
</table >
<body>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript" >
var tdcur=""; function enterstr(){
var td=document.getElementById(tdcur);
td.innerText=prompt("请输入","");
}
</script >
<style type="text/css" >
<!--
TD.Edit {
mouse: expression(
onmouseover=function(){this.style.background= "#CCCCCC "},
onmouseout=function(){if(tdcur!=this.id) this.style.background= " "},
onclick=function(){var tdPrev=document.getElementById(tdcur);if(tdPrev!=null)tdPrev.style.background= " ";tdcur=this.id;this.style.background= "#CCCCCC ";enterstr()}
)
}
-- >
</style >
<table border="1" >
<tr >
<td id=td1 width="30" height="30" class="Edit" > </td >
<td id=td2 width="30" height="30" class="Edit" > </td >
<td id=td3 width="30" height="30" class="Edit" > </td >
</tr >
<tr >
<td id=td4 width="30" height="30" class="Edit" > </td >
<td id=td5 width="30" height="30" class="Edit" > </td >
<td id=td6 width="30" height="30" class="Edit" > </td >
</tr >
<tr >
<td id=td7 width="30" height="30" class="Edit" > </td >
<td id=td8 width="30" height="30" class="Edit" > </td >
<td id=td9 width="30" height="30" class="Edit" > </td >
</tr >
</table >
<body>
</body>
</html>
那里有好多效果,而且能看到原码