Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help> make an HTML page to solve engineering examples

  1. Sep 18, 2012 #1
    Hello everybody;

    I need your help in making an HTML page used to solve engineering examples with equations and many tables will be used (maybe I should use Java Scripts).. the inputs will differ due to the user.

    Please help me ,,
     
    Last edited by a moderator: Sep 20, 2012
  2. jcsd
  3. Sep 18, 2012 #2

    jedishrfu

    Staff: Mentor

    can you explain this better. Are you trying to make a cheat sheet where all the key formulas of a given course are listed on one page?

    if its a static page then you don't need javascript.

    or are you trying to make a calculator to solve any kind of engineering problem then I suggest you just use MATLAB.
     
  4. Sep 19, 2012 #3
    Hello, jedishrfu
    thanks for your reply


    No it's not for cheating, it's an assignment >>>

    its not static page at all,,, this page is used to solve the examples in a book but the inputs are differ ,, there is an example in the attachments;

    for this example the diameter of the shaft may differs or the bending moment ..etc
    also this example uses a table to get information due to the data given...


    If I use MATLAB its difficult to put it in an HTML page...//



    I hope you Understand me ,,,

    Mod note: Just because you have learned some HTML, it's not necessarily a good idea to use it all in one post.
     

    Attached Files:

    Last edited by a moderator: Sep 20, 2012
  5. Sep 19, 2012 #4

    jedishrfu

    Staff: Mentor

    okay I understand.

    There's two ways to proceed using javascript with your web page or using a web server that does the calculations and returns a web page.

    I think the javascript should be sufficient. You'll need to check out jquery + javascript. jquery will help you write javascript that will work across many different browser types.

    Next for charting you'll need something like jsxgraphcore.js

    http://jsxgraph.uni-bayreuth.de/wp/

    If you plan to use a backend web server consider using grails. it comes with a built-in server and uses groovy as the base language. groovy is a scripting superset of java. Groovy scripts can run java code pretty much unchanged (there are some keyword issues and other syntax oddities).

    Now how should you start:

    1) checkout jsxgraph examples and see if you can use it to do what you want.
    2) learn some java script and jquery if jsxgraph isn't enough
    3) lastly for more comprehensive modeling and heavy math consider using the webserver. (this may be overkill for your project but wanted to let you know there's another path)

    EDIT: I forgot to mention that you could also use PHP web server solution if the javascript can't handle the complexity.
     
    Last edited: Sep 19, 2012
  6. Sep 20, 2012 #5

    jedishrfu

    Staff: Mentor

    so what did you decide to do?
     
  7. Sep 20, 2012 #6
    Thank you very much jedishrfu ....

    Actually I'm not an expert in programing, but let me try these programs you mentioned..
     
  8. Sep 20, 2012 #7

    jedishrfu

    Staff: Mentor

    The jsxgraph stuff and javascript should keep you busy for some time and if you get good at it you can throw in a CSS to make the web page look like an Android app display (I'm just learning about this myself from the book Android Apps by Jonathan Stark from Orielly Press).
     
  9. Sep 26, 2012 #8
    <b> Please can anyone help me with JavaScript that I want to put a variable that the user will enters, for example :</b>

    <i> enter the length [here the user will enters a number]</i>
     
    Last edited: Sep 26, 2012
  10. Sep 26, 2012 #9

    gabbagabbahey

    User Avatar
    Homework Helper
    Gold Member

    In the simplest case, you just use an HTML <input> tag to accept the user's input, and a <button> to trigger a javscript function that processes that input. An example is as follows:

    Code (Text):
    <script>
      function ok(){
        var elm1 = document.getElementById("1");
        var numericExpression = /^[0-9,\.]+$/;
        if(!(elm1.value.match(numericExpression))){
          alert("Enter a positive number for Length");
        }else{
          //do stuff with valid value
        };
      };
    </script>
    <html>
      <body>
         Enter Length: <input type="text" name="Length" id="1" value="10"><br>
        <button type="button" onclick="ok()" >OK</button>
      </body>
    </html>
     
  11. Sep 26, 2012 #10

    jedishrfu

    Staff: Mentor

  12. Sep 29, 2012 #11
    Yes I got it ,,
    thank you jedishrfu ..,,,
    But I gonna use many inputs and I will use these inputs again in an equation to calculate ___________________
    in your example did you define the input as elm1 ???
     
  13. Sep 29, 2012 #12

    jedishrfu

    Staff: Mentor

    in gabbagabbahey's example the var elm1 is the input notice the var stmt queries the document for id #1 which in the html the input field.

    You should really checkout the jquery as it is the preferred way of using javascript and is cross-browser capable.
     
  14. Sep 29, 2012 #13

    gabbagabbahey

    User Avatar
    Homework Helper
    Gold Member

    You can set the Id attribute for most (All?) HTML elements. In my example, I set Id="1" for the <input> element. Doing that meant I could easily retrieve that element in my javascript function by using the document.getElementById("1") method, and store it in a variable which I declared as var elm1 in my function. The document.getElementById("1") method will return a DOM object for the element with Id="1", which will allow you to access all of the properties and and methods of the appropriate class of DOM Object, which in the case of my example was a DOM Text Object.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help> make an HTML page to solve engineering examples
Loading...