By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,759 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,759 IT Pros & Developers. It's quick & easy.

Making a table display in a new window

P: 2
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
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
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.