469,309 Members | 2,781 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,309 developers. It's quick & easy.

change content of the table

76
hi,
is there any way i could click on the html table content (<td>) and edit the info, and then click a button to update the modification into a database?
i found the following function off the internet, and it really doesn't do the thing that mentioned above, but just replaces the content with the specified "WORD".

Expand|Select|Wrap|Line Numbers
  1. function changeContent(){
  2.     var x=document.getElementById('myTable').rows
  3.     var y=x[0].cells
  4.     y[0].innerHTML="NEW CONTENT"
  5. }
  6.  
please help. thanks a lot in advance.
Feb 23 '08 #1
3 1649
dlite922
1,584 Expert 1GB
why don't you put the contents of the <td> into a text field

[PHP]
<td><input type="text" name="nameGoesHere" value="Value Here" /></td>

[/PHP]

You don't like the looks of it you say? want it to look like regular text?

You can completely change the look of an input tag with css.

background color, no border would do the trick for you.

" Google input html css "
Feb 24 '08 #2
idorjee
76
hi dlite922,
thanks for your reply. i tried that already and doesn't work. here is what i'm actually doing:
the script gets the $desc (string) from somewhere, and
Expand|Select|Wrap|Line Numbers
  1. echo "<TR bgcolor=\"#660000\"><TD COLSPAN=2><input type=\"text\" name=\"desc\" value=\"$desc\" /></TD></TR>";
  2.  
the next thing that i'm trying to do is to submit the $desc variable, AFTER making some changes to it, to another script that would insert it into the database:
Expand|Select|Wrap|Line Numbers
  1. echo "<form name=\"go\" method=\"post\" action=\"ezadd.php\">";
  2. echo "<input type=\"hidden\" name=\"desc\" value=\"$desc\">";
  3. echo "<input type=\"submit\" name=\"submit\" value=\"Add to DB\">";
  4.  
Thank you!
Feb 24 '08 #3
acoder
16,027 Expert Mod 8TB
the next thing that i'm trying to do is to submit the $desc variable, AFTER making some changes to it, to another script that would insert it into the database:
Without refreshing the page?
Feb 25 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Csaba2000 | last post: by
14 posts views Thread by Reply Via Newsgroup | last post: by
11 posts views Thread by SarahMarsden | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.