www.webdeveloper.com
Results 1 to 2 of 2

Thread: form output troubles

  1. #1
    Join Date
    May 2011
    Posts
    2

    form output troubles

    Hi guys
    i am trying to make a form that out puts the inputs to a table and makes the form disappear in the process. I am encountering too problems though

    a) at the submitt bit it says object expected for "document.getElementById('tablename').value=
    document.getElementById('name').value"

    why what did i forget to do??

    b) am i missing a section of code needed to not only output the data to table but make form disappear?

    this is the full code
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    	<head>
    		<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    		
    		<title>
    			HiQuote
    		</title>	
    		
    		<!-- Local JavaScripts -->
    		
    		<script type="text/javascript">
    			
    			// --------------------------------------------
    			// the 'program' - the CONTROL LAYER
    			
    			function getElementById(" " )	
    			
    			{
    				button onclick="document.getElementById(" ")
    				
    			}
    			
    			
    			// ---------------------------------------------
    			// The global variables - the PERSISTENCE LAYER (sort of!)
    	
    			var Name;
    			var Number;	
    			var button onclick="document.getElementById(" ")
    			
    			// ---------------------------------------------
    			// The processing functions - the LOGIC LAYER			
    			
    			
    	
    			
    			// ---------------------------------------------
    			// The input/ output functions - the PRESENTATION LAYER
    			//      THIS enhanced presentation layer uses a web page form for input
    			//      and output.			
    			
    					
    			
    		</script>		
    	</head>  
    	<body>			
    		<form name="form" action=" " >
    			INPUT DATA:<br/><br/>
    			Customer name (text): <input name="dataInputName" id="Name" type = "text" size="30" /><br/><br/>
    			Phone number (text): <input name="dataInputNumber" id="Number" type ="text" size="10" /><br /><br />
    			<button onclick="document.getElementById('tablename').value=
    			document.getElementById('name').value">Submit</button>
    			</form>
    			<table>
    				<tr>
    					<td id="tablename">
    					
    					</td>
    				</tr>
    				<tr>
    					<td id="tablenumber">
    					
    					</td>
    				</tr>
    			</table>
    	</body>
    </html>

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    It looks like you have not understood the basis of the basis of the JavaScript language, its syntax, events and methods.

    You need first to study:
    http://www.w3schools.com/js/default.asp
    https://developer.mozilla.org/en/JavaScript/Guide
    http://www.howtocreate.co.uk/tutoria...ript/dombasics

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles