How to automatically run this code

2019-08-30 12:22发布

问题:

you are always such an incredible help to me ... but, Im really stumped here.

http://canboria.co.za/PHP/CALCULATOR/bond.htm

A basic bond/mortgage calculator that I have worked out using some online refs & a little modification.

How can I make this script work out the details on page loading (i did try action onload but, didnt do the trick ... kept running a loop & times out)

Ideally, I want to have that each time a value is altered, it should work out the REPAYMENT VALUE ... any help, ideas or guidence greatly appreciated!

回答1:

The window.onload function seems to work for me.

Working Example

By simply adding this code

window.onload=giveAnAnswer;