| | |
Generating Fields On the Fly
![]() |
hello..
try this code:
and also check:
http://www.daniweb.com/forums/thread135356.html
try this code:
html Syntax (Toggle Plain Text)
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Third Santor</title> <script> function generate(){ var myDiv = document.getElementById('someid'); var objTextArea = document.getElementById('mem1'); var list = objTextArea.value.split('\n'); var tbody = document.createElement('tbody'); for(var i=0; i<list.length; i++){ var cell1 = document.createElement('td'); var label = document.createTextNode(list[i]); cell1.appendChild(label); var cell2 = document.createElement('td'); var textbox = document.createElement('input'); textbox.type = 'text'; textbox.id = list[i]; cell1.appendChild(textbox); var row = document.createElement('tr'); row.appendChild(cell1); row.appendChild(cell2); tbody.appendChild(row); } var table = document.createElement('table'); table.border = 1; table.appendChild(tbody); /* var submit = document.createElement('input'); submit.type = 'submit'; submit.value = 'Submit'; */ myDiv.appendChild(table); myDiv.appendChild(submit); } </script> </head> <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"> <form name="frm1" method="post" action="" onsubmit="return "> <textarea name="mem1" id="mem1" rows="10" cols="30"></textarea> <input type="button" value="Generate" onclick="generate();"> </form> <DIV id="someid"></DIV> </body> </html>
http://www.daniweb.com/forums/thread135356.html
Last edited by Shanti Chepuru; Oct 8th, 2008 at 9:20 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
![]() |
Other Threads in the PHP Forum
- Previous Thread: Multiple files Upload plz HelP
- Next Thread: Need the help of a programer
Views: 474 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array auto box buttons cakephp check checkbox class cms code combobox database date directory display download dropdown drupal dynamic echo email error file files folder form forms functions header hosting href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql onclick order parse password paypal pdf php post problem query radio random recursion redirect regex remote rewrite rows script search select server session sort source sql storage string table update upload url user validation variable video web website wordpress xml zend






