Skip to content

Anshu Verma Posts

PowerSchool Student Class List SQL

Replace %param1% will be the Student ID

Replace %param2% will be Year ID

Increment number by 0.01 in javascript using a loop

Recently, I took over a project where I had to replace numbers starting from 1.xx and ending up at 10 on a page. Initially, the code was:

but the issue with the code was that it was generating number like:

1.1300000000000001
1.1400000000000001
1.1500000000000001
1.1600000000000001
1.1700000000000002
1.1800000000000002
1.1900000000000002
1.2000000000000002
1.2100000000000002
1.2200000000000002

The issue was with the inaccuracy of floating point numbers. To fix this issue I used:

Get URL Parameter through Javascript

Javascript Function

Call function to read Parameters

FileReader with Progress (Pure Javascript)

HTML

CSS:

Javascript:

JSFiddle: https://jsfiddle.net/anshuverma1989/v5f0kzcc/

Create a Loading Page – Pure CSS

HTML:

CSS:

JSFiddle: https://jsfiddle.net/anshuverma1989/e5achyha