Home  >  Article  >  Web Front-end  >  How to save and operate numeric type variables in the page in JavaScript_javascript skills

How to save and operate numeric type variables in the page in JavaScript_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:51:191167browse

Previously, I embedded the following javascript fragment in the html page, but when a button is clicked, the i value will be increased by one, but after two clicks, the initial value of i has not changed.

Copy code The code is as follows:



Later, the variable was declared in a test object, as shown in the following code. In this way, every time test.i is changed, the value of test.i can be saved

Copy code The code is as follows:


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn