E
E
Eugene2021-07-19 03:21:28
JavaScript
Eugene, 2021-07-19 03:21:28

How to hang two events on a button, first refresh the page and then calculate the calculator?

Good day! Tell?

I have a button that performs all sorts of checks, calculations, and so on. I would like that when you click on it, the page is first updated, and then the results of the calculation are displayed.

Here is a non-working example:

<INPUT onclick=window.location.href="test.html"; compute(this.form) type=button value="Рассчитать" id="button1">


The page is updated, but the calculation is not performed : [

A way is also suitable not to refresh the page, but somehow erase all previous calculations before displaying new ones, what can be written in this line so that these two actions work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2021-07-19
@3vgeny90

You make a regular link with some marker, for example:

<a href="test.html#calculate-results">Рассчитать</a>

And on the test.html page, when loading, check whether this marker exists. If it does, start the calculations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question