Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 JavaScript: Click to edit Table Cell Jump to:  
Category: >> JavaScript >> Click to edit Table Cell Bookmark and Share

<< lastnext >>

Snippet Name: Click to edit Table Cell

Description: Click to edit a table cell inline.

Comment: (none)

Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: February 27th, 2009

<html>
<head></head>
<body bgcolor="#ffffff">
 
<style>
.nbb
{
 border:none;
 background:none;
 margin:0;
 padding-left:5px;
 }
.bb
{
 border:normal;
 background:normal;
 margin-top:-11;
 margin-left:-3;
 padding-left:5px;
 position:absolute;
 }
</style>
<script language="javascript">
FUNCTION put_contents(id)
{
 document.getElementById(id).readOnly =  FALSE;
 document.getElementById(id).className = "bb";
 document.getElementById(id).FOCUS();
 document.getElementById(id).select();
 }
FUNCTION restore_it()
{
 document.getElementById("in4").readOnly =  TRUE;
 document.getElementById("in4").className = "nbb";
 document.getElementById("in8").readOnly =  TRUE;
 document.getElementById("in8").className = "nbb";
 document.getElementById("in12").readOnly =  TRUE;
 document.getElementById("in12").className = "nbb";
 }
</script>
 
NOTE: Only the 4th column in this example is editable. 
 
 
<form method="POST">
<table border=1 cellpadding=0 cellspacing=0>
 <tr>
  <td onclick="restore_it();"><input class="nbb" id="in1" value="Row 1 Colom 1" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in2" value="Row 1 Colom 2" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in3" value="Row 1 Colom 3" readonly></td>
  <td bgcolor="#ffffdd" ondblclick="put_contents('in4');" onclick="restore_it();"><input class="nbb" name="in4" id="in4" value="Test data 4" readonly></td>
 </tr>
 <tr>
  <td onclick="restore_it();"><input class="nbb" id="in5" value="Row 2 Colom 1" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in6" value="Row 2 Colom 2" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in7" value="Row 2 Colom 3" readonly></td>
  <td bgcolor="#ffffdd" ondblclick="put_contents('in8');" onclick="restore_it();"><input class="nbb" name="in8" id="in8" value="Test data 8" readonly></td>
 </tr>
 <tr>
  <td onclick="restore_it();"><input class="nbb" id="in9" value="Row 3 Colom 1" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in10" value="Row 3 Colom 2" readonly></td>
  <td onclick="restore_it();"><input class="nbb" id="in11" value="Row 3 Colom 3" readonly></td>
  <td bgcolor="#ffffdd" ondblclick="put_contents('in12');" onclick="restore_it();"><input class="nbb" name="in12" id="in12" value="Test data 12" readonly></td>
 </tr>
 <tr>
  <td colspan=4 style="text-align:center;padding:5px;" onclick="restore_it();"><input type="submit" name="submit" value="Submit"></td>
 </tr>
</table>
</form>
 
 
</body></html>


Free
Oracle Magazine
Subscriptions
and Oracle White Papers


SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 55 users online    © 2009 psoug.org

PSOUG LOGIN
Username: 
Password: 
Forgot your password?