codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Entering text to be displayed in a table on the same page  TKOEHN5751 at 22:50 on Wednesday, September 10, 2003
 

I have a web page where people can enter their name and address into text input fields.

Using JavaScript,
I want them to be able to click a button that will make their entered information appear in a designated table on the same page.

Can this be accomplished relatively easy?


Any suggestion would be greatly appreciated,
Thanks


  Re: Entering text to be displayed in a table on the same page  Troy Wolf at 00:41 on Thursday, September 11, 2003
 

Sure! A DHTML solution is what you need. You say you want to copy the values into a table. Will the table cells already exist? Or do you need to also write the table cells?
Troy Wolf: site expert
Shiny Solutions


  Re: Entering text to be displayed in a table on the same page  TKOEHN5751 at 01:23 on Thursday, September 11, 2003
 

I had planned on having a table already created and positioned a little lower on the page.

Basicly I wanted to populate the cells of the table with the values from my input fields. Perhaps by using the "onclick" command.

  Re: Entering text to be displayed in a table on the same page  Troy Wolf at 02:30 on Thursday, September 11, 2003
 

You mean like this?
<script language=javascript>
function CopyValues()
{
var f = document.forms[0];
document.getElementById("colName").innerHTML = f.fullName.value;
document.getElementById("colAddress").innerHTML = f.address.value;
document.getElementById("colCity").innerHTML = f.city.value;
document.getElementById("colState").innerHTML = f.state.value;
}
</script>
<form>
Name<br>
<input type=text name=fullName><br>
Address<br>
<input type=text name=address><br>
City<br>
<input type=text name=city><br>
State<br>
<input type=text name=state><p>
<input type=button value="Copy Values" onclick=CopyValues()>
</form>
<table border=1 cellpadding=4>
<tr>
<th width=100>Name</th>
<th width=200>Address</th>
<th width=100>City</th>
<th width=50>State</th>
</tr>
<tr>
<td id=colName> </td>
<td id=colAddress> </td>
<td id=colCity> </td>
<td id=colState> </td>
</tr>
</table>
Troy Wolf: site expert
Shiny Solutions


  Re: Entering text to be displayed in a table on the same page  TKOEHN5751 at 18:47 on Friday, September 19, 2003
 

This worked perfectly.

Thanks for your help.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: onload event
•  Active Widgets
•  Re: onmouseover change image and text
•  Line Printer Interface
•  import contacts of msn/yahoo
•  Call windows apps from web apps
•  Re: ASP.NET web controls
•  netscape 6 browser problem
•  Re: Print .doc file from the website using System.Diagnostics.Process


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005