Help> make an HTML page to solve engineering examples

  • Thread starter Eng.Naif
  • Start date
  • #1
8
0

Main Question or Discussion Point

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:

Answers and Replies

  • #2
11,700
5,271
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.
 
  • #3
8
0
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.
 

Attachments

Last edited by a moderator:
  • #4
11,700
5,271
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:
  • #5
11,700
5,271
so what did you decide to do?
 
  • #6
8
0
Thank you very much jedishrfu ....

Actually I'm not an expert in programing, but let me try these programs you mentioned..
 
  • #7
11,700
5,271
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).
 
  • #8
8
0
<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:
  • #9
gabbagabbahey
Homework Helper
Gold Member
5,002
6
<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>
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:
<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
8
0
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 ???
 
  • #12
11,700
5,271
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.
 
  • #13
gabbagabbahey
Homework Helper
Gold Member
5,002
6
in your example did you define the input as elm1 ???
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.
 

Related Threads on Help> make an HTML page to solve engineering examples

  • Last Post
Replies
10
Views
3K
  • Last Post
Replies
7
Views
2K
  • Last Post
Replies
9
Views
712
Replies
15
Views
841
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
19
Views
935
  • Last Post
Replies
3
Views
9K
Replies
1
Views
2K
Top