Help> make an HTML page to solve engineering examples

In summary: In short, you can use the <input> tag to capture user input and store it in a variable. You can use the <button> tag to trigger a function that processes the input.
  • #1
Eng.Naif
8
0
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:
Technology news on Phys.org
  • #2
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
Hello, jedishrfu
thanks for your replyNo 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

  • Untitled.png
    Untitled.png
    38.4 KB · Views: 365
  • Untitled2.png
    Untitled2.png
    25.4 KB · Views: 418
Last edited by a moderator:
  • #4
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:
  • #6
Thank you very much jedishrfu ...

Actually I'm not an expert in programing, but let me try these programs you mentioned..
 
  • #7
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
<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
Eng.Naif said:
<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
Yes I got it ,,
thank you jedishrfu ..,,,
But I going to 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
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
Eng.Naif said:
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.
 

1. How can I create an HTML page for solving engineering examples?

In order to create an HTML page for solving engineering examples, you will need to have a basic understanding of HTML coding and structure. You can start by creating a new HTML document and using tags such as <head>, <title>, <body>, and <h1> to structure your page. You can also use <table> tags to organize your content into columns and rows.

2. What are some important elements to include in an engineering example HTML page?

An engineering example HTML page should include a clear title, a brief description of the problem or scenario, any necessary equations or diagrams, and the step-by-step solution to the problem. It is also helpful to include interactive elements such as input boxes or buttons to allow users to input their own values and see the results.

3. How can I make my HTML page interactive for solving engineering examples?

To make your HTML page interactive, you can use JavaScript to create functions that will perform calculations based on user input. You can also use HTML input tags such as <input type="text"> to allow users to input values and <button> tags to trigger the calculation function.

4. Is it possible to include images or videos in an engineering example HTML page?

Yes, it is possible to include images and videos in an engineering example HTML page. You can use the <img> tag to insert images and the <video> tag to insert videos. It is important to provide alternative text for these elements in case they cannot be displayed.

5. Can I use CSS to style my engineering example HTML page?

Yes, you can use CSS to style your engineering example HTML page. This can include changing the font, color, and layout of your page. You can use inline CSS by adding style="property: value;" to individual HTML tags, or you can create an external CSS file and link it to your HTML page using the <link> tag.

Similar threads

  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
4
Views
336
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
7
Views
472
  • Programming and Computer Science
Replies
13
Views
1K
  • Programming and Computer Science
Replies
13
Views
503
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
Back
Top