ISCL is a Intelligent Information Consulting System. Based on our knowledgebase, using AI tools such as CHATGPT, Customers could customize the information according to their needs, So as to achieve

How to Set a JavaScript VAR to Float

18
    • 1). Launch the standard, plain-text text editor application that is available on your computer.

    • 2). Enter the following code into the text editor.

      <html>

      <body>

      <script type="text/javascript">

      var numberstring="123.456";

      var floatingnumber;

      document.write("This is the string, 123.456 converted to a floating point number: " + parseFloat(numberstring)+"");

      floatingnumber=parseFloat(numberstring)+.01;

      document.write("Add the 0.1 to this and get: "+floatingnumber+"");

      document.write("Add the 0.1 to the string, 123.456 and get: "+numberstring+.01+"");

      </script>

      </body>

      </html>

    • 3). Click the File menu. Select the "Save" option. Save under the file name "test.html".

    • 4). Launch the web browser that is available on your computer. Click on the "File" menu item and select "Open File"

    • 5). Locate the file "test.html" just created, select it with the mouse then click on "Open".

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.