| | |
Javascript- How to load cell values to a form???
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2009
Posts: 5
Reputation:
Solved Threads: 0
hi, I'm trying to load cell values from a table, to a form in Javascript.... I can caught the cell values but I can't load them to a form....
this is how I caught the cell values:
Thank everyone.....
this is how I caught the cell values:
html Syntax (Toggle Plain Text)
<td id='cellText' >writing the text </td> <script> alert(document.getElementById('cellText').innerHTML); </script>
Thank everyone.....
Last edited by peter_budo; Jun 4th, 2009 at 9:44 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
you do a similar process to the form, get the form id, then the input field and then do
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
.value=document.getElementById('cellText').innerHTML
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<html> <head> <script type="text/javascript"> function getvalue() { one=document.getElementById("cellone").innerHTML document.getElementById("box1").value=one; } </script> <body> <form id="form1"> <table > <tr> <td id="cellone">hello</td> </td> </tr> </table> <input type="text" id="box1" onclick="getvalue();"> </body> </form> </html>
with this you can capture the value on clicking on the text box..
you could change the event according to what suits you..
hope it helps..
Enrico,
As already said, plus it can be proceduralised in a loop as follows:
Airshow
As already said, plus it can be proceduralised in a loop as follows:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Untitled</title> <script> onload = function(){ for (var i=1; i<=3; i++) { var field = document.getElementById('ip_'+i); if(field) { field.value = document.getElementById('cellText'+i).innerHTML; } } } </script> </head> <body> <table border> <tr><td id='cellText1' >Text 1</td></tr> <tr><td id='cellText2' >Text 2</td></tr> <tr><td id='cellText3' >Text 3</td></tr> </table> <form> <input id="ip_1" /><br> <input id="ip_2" /><br> <input id="ip_3" /><br> </form> </body> </html>
Last edited by Airshow; Jun 4th, 2009 at 8:46 am.
![]() |
Similar Threads
- Save the values of a form (HTML and CSS)
- passing values from a form to a dialog form (VB.NET)
- Setting Values of Input Box in Iframes via Javascript (JavaScript / DHTML / AJAX)
- All the values in the form passing to EditServlet are null when use javascript (JavaScript / DHTML / AJAX)
- Form's controls data takes too long to load (ASP)
- compare cell values (ASP.NET)
- Taking Values from another form to Table layout panel ("How?") (VB.NET)
- Cant get the cell values,please help,thanks. (JavaScript / DHTML / AJAX)
- How to pass the values of javascript in perl (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Problem in Mozilla Browsers
- Next Thread: Multiple script tags?
| Thread Tools | Search this Thread |
ajax ajaxexample ajaxjspservlets array browser bug captcha captchaformproblem cart checkbox child class close codes cookies createrange() cursor date debugger dependent disablefirebug dom dropdown editor element embed engine enter events explorer ext file firefox form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl maps marquee masterpage math matrixcaptcha media menu object onerror onmouseoutdivproblem onreadystatechange parent paypal pdf php position post programming progressbar prototype rated redirect runtime safari scale scriptlets scroll search security session shopping size software star stars synchronous toggle unicode variables web webservice wysiwyg \n





