Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript update without <onload>

    I have a small "form based" javascript calculator, that gets var (values) from a serial connection to a local server.
    My question is is their a language i can use to run the script if the var (value)
    change without opening a browser? I can redirect a browser to run the function
    ok. but ,I would have to load a web page to do it.
    Thank You, For any Help or direction.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    I'm surprised that javascript allows serial port communication.
    Almost any application language can do this including java, C#, C/C++, perl, ruby, PHP, etc etc. To run without a browser, you can use Java for unknown platform, or C# for windows.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,634
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by Fou-Lu View Post
    I'm surprised that javascript allows serial port communication.
    It doesn't when run in a browser. It might be able to though if run as a desktop or server application.

    One option for the desktop is to use Adobe Air - JavaScript is one of the three languages it supports for writing desktop applications.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you all for your reply,i am new to this forum so i'll try to be more clear.
    Javascript is used to run a calculator function that i wrote. but although i did learn a lot writing this script, It turns out to be client side solution you have to load a web page to do the calculations.Maybe i need to do this spreadsheet type of script on the server side possibly PHP script in my root folder of the server. then when values change
    it will calculate with out the need for a web page interaction is this about right ?
    You think i ought to learn PHP to do this "Spreadsheet" or is their some way i can convert the Javascript to PHP hear is a a bit of code
    <html>
    <head>

    <SCRIPT language="JavaScript">
    function Calculate
    {
    var Calc,xm;
    //////Cal?
    xm =parseFloat(document..Calc.Lattitude.value);
    Calc = Math.PI/180 * xm ;
    document.Spread.Radian.value = Math.round(Calc*100)/100 ;
    }
    </script>

    </head>
    <body onLoad="Calculate">

    <form name="Calc" method="post" action ="">
    <table width="75%" border="1">
    <tr>
    <td>Latitude</td>
    </tr>
    <tr>
    <td><input type="text"name="Lattitude" value="<var00>"></td>
    </tr>
    </table>
    </form>

    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •