Program index   Book index (in Chinese) Update 2007-04-13

This file discuss several problems in Javascript programming.
1: How to define high dimension array?
2: How to recover radio button value?
3: Why '08' can never increase to '09'?
4: parseInt("1.2e-6")=1 !? But it should be zero!!

Freeman's work has no one review, please check the correctness first.
9604050843

<a name="topic01">

Please fill in dimension size, up to five dimension
Must have one dimension, boxA must be filled
Box for array dimension (BoxA,B,C,D,E)
Array name
Initial value 0; or any string, change ["] to [\"] and [\] to [\\]

Box1    

Array definition in box1 has uniform initial value. If initial value is different for different elements
please use box2 to modify. String must add 'quotes' or add "quotes"
Box2  

Above box1 and box2 are controlled by parameter boxes A to E and initial value box.
Function tryArray() simulate user's program. Box3 output is independent from page top parameter boxes.
Box3   lines no ok


<a name="topic02">
Column 1 2 3 4 5 6 7 or column number ; separator

2007-04-04-16-52 save as
C:\$fm\wk\remember_radio_button.htm

This file remember the radio button which was
selected. If user fill number to [column number]
box, radio button unchecked on blur. If user
clear box value, right radio button is re-checked.
The reason that program remember which radio
button was clicked, that is because program use
<INPUT type="hidden" id="box53" value="">
to remember.

Please view source and find "function box51used()"

2007-04-04-17-05 stop



<a name="topic03"> 2007-04-05-07-41 The following is a small problem in programming. When modify milu page (Chinese) http://freeman2.com/milu0001.htm use string "ml112100" to indicate in-page stop point. "ml112100" separate as ml-11-21-00  ml  indicate milu 11  indicate chapter 11 21  indicate section 21 00  indicate section title (01 indicate paragraph 01 ) Change chapter, manual change from 11 to 12 Change section, manual change from 21 to 22 Change chapter about one hour once Change section about two minutes once. manual change cause error. For example, it should change from ml034104 to ml034204 but human error from ml034104 to ml035104 Above is real error record. Manual error happened twice, for correctness, for speed, decide to write function function increase0() //9603241038 Auto change section number. [ml110100」 increase to [ml110200」 no trouble [ml110200」 increase to [ml110300」 no trouble …………… [ml110800] increase to [ml110900] but get [ml110000] At first, do not know why. A little bit think find out reason. When increase from [ml110100] to [ml110200]  take out [01] increase to [02], then paste back. 1, 2, .... 8, 9, 10 are decimal system numbers. But 01, 02, .... WRONG 08, 09 WRONG are octonary numbers. octonary base numbers are 0,1,2,3,4,5,6,7 decimal base numbers are 0,1,2,3,4,5,6,7,8,9 My intention is to take out [08] increase to [09], But [0] in [08] tell computer this is an octonary number. Octonary base numbers do not use [8] [08] is undefined, computer treat [08] as [00] then [08] "increase" to [01], never get [09] !! The way to solve this problem is to delete [0] from [08], send [8] to program to increase by one. then get 9. Time label //9603241103 has code to exam if left side in '0' Time label //9603241106 drop [0], use only [8] related code is next [[ // jj record 4th and 5th byte value. // which is [21] in [ml112100] (start from 0th !) jj=keyStr2.substring(4,6); //j0=parseInt(jj); //j0=parseInt("08"); get j0=0 ??!! 9603241057 // program treat "01" ... "08" as octonary number // 9603241122 // change 01, 02, .... 08, 09 to 1, 2, .... 8, 9 if(jj.charAt(0)=='0') //9603241103 jj=jj.charAt(1); //9603241106 OK // string '1' add string '2' get string '12' // number 1 add string '2' get string '12' // number 1 add number 2 get number 3 // parseInt(jj); change from string to integer number // parseFloat(jj); change from string to float number j0=parseInt(jj); j1=j0+1; // center step, increase one here. ]] Above code is in next Chinese page http://freeman2.com/booklist.htm 2007-04-05-08-09 stop

<a name="topic04"> 2007-04-05-08-50 Number 1.2e-6 is 0.0000012 Quoted "1.2e-6" is string, and not a number Click [Test] button get next output (Box3 bottom) [[ parseInt(2.3)=2 parseInt(0.0000012)=0 parseInt(1.2e-6)=0 parseInt("1.2e-6")=1 parseInt(parseFloat("1.2e-6"))=0 9604050855 ]] parseInt("1.2e-6")=1 ?? But it should be zero!! To solve this problem, first run var dim1b=parseFloat(dim1); then run var dim1a=parseInt(dim1b); //9604042144 2007-04-05-09-06



Book list (All Chinese books)
http://freeman2.com/booklist.htm

Program list
http://freeman2.com/jsindex2.htm

This program started and done on 2006-10-21

2007-04-04 create array page
http://freeman2.com/jsarray2.htm

This page first uploaded on 2007-04-12

Thank you for visiting Freeman's web site.
Freeman