469,963 Members | 2,803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Making a table display in a new window

Ok im designing an application for working out compount interest. The user starts the page, 3 prompts appear, one asking for money invested, next asking for rate of interest, and last one asking for length of time money invested. All what now displays on the page is simple a calculate button. When the user clicks this calculate button, a new window opens, showing in table form what the user inputted and the actual calculation.

I have all the calculation working, and just for the purpose of testing I had the table appearing on the first page with the calculate button and everything appears fine in the table, but now im having problems getting the table to display on the new window and still inputting the values they inputted into the text boxes.

The code for the one model was:

<html>
<title>
</title>
<head>
<script language="JavaScript">

function calccomp()

{

money=prompt("Enter the amount of money you wish to invest () :","1000");
interest=prompt("Enter the interest rate & :","2");
payments=prompt("Enter the length of time in months :","12");

}

calccomp();

</script>

</head>

<body>

<script language="JavaScript">

result=Math.round(Math.pow((1+interest/100),(payments/12))*money*100)/100;

actinterest=Math.round((result-money)*100)/100;


</script>

<table border="1">
<tr>
<td>Money invested ()</td>
<td><script> type="text/javascript">document.write(money);</script></td>
</tr>
<tr>
<td>Interest Rate (%)</td>
<td><script> type="text/javascript">document.write(interest);</script></td>
</tr>
<tr>
<td>Time Invested (months)</td>
<td><script> type="text/javascript">document.write(payments);</script></td>
<tr>
<td>Total Amount</td>
<td><script> type="text/javascript">document.write(result);</script></td>
</tr>
<tr>
<td>Interest</td>
<td><script> type="text/javascript">document.write(actinterest);</script></td>
</tr>
</table>


</body>
<html>

The above doesnt contain the button just shows the table works.



Now this code... this has a push button, and just for testing purposes I had one of the variable values appearing on the next page when the button was clicked. The code is:

<html>
<title>
</title>
<head>


</head>

<body>


<SCRIPT language="JavaScript">

money=prompt("Enter the amount of money you wish to invest () :","1000");
interest=prompt("Enter the interest rate & :","2");
payments=prompt("Enter the length of time in months :","12");


function callcalc()
{
result=Math.round(Math.pow((1+interest/100),(payments/12))*money*100)/100;

actinterest=Math.round((result-money)*100)/100;

newwindow=window.open();
newdocument=newwindow.document;
newdocument.write(money);

}

</SCRIPT>

<FORM>

<INPUT type=BUTTON value="Push me!" onClick="callcalc()">

</FORM>

</body>

<html>




...So what im asking is, with the table code I had how can I make all this appear on the seconds page correctly when the button is pressed on the first page.

Many thanks,

Darren
Nov 25 '06 #1
1 1649
ronverdonk
4,258 Expert 4TB
Maybe I would have a look at your code if it was enclosed witin php, code or html tags as requested in the Posting Guidelines at the top of this forum! That would make it a lot easier to read for our members.

Alas, it is not so, with pity, I will not look at this bunch of unstructured code.

Ronald :cool:
Nov 25 '06 #2

Post your reply

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

By using this site, you agree to our Privacy Policy and Terms of Use.