Search This Blog

Sunday, April 10, 2016

Student Information Form using JavaScript and HTML

Basically, student detail form consist of various fields like name, Marks of subjects, total, average etc.
This is basic example of form in HTML. This should be able to help you to get some idea about to how to create some forms and make buttons works using HTML.


HTML is basic markup language to for any website, which is very compatible with most of the scripting language available in present day. So what do you need to know before we can move forward with this form creation :-

1. Basic knowledge about HTML
2.Difference between java script and HTML
3. Knowledge about basic HTML tags 
4. Basic syntax about Java scripts
5. Function of Buttons

So, if you know how to that then we are good to go ahead with program.
When you are able to execute the code you should get form something like this :

Student Information Table

This is simplest table you can hope to create using HTML, Those buttons will calculate the total, average , result and grade as given by programmer.
Now, that's not hard and confusing at all is it?
So, now you are wondering how to it?
Here is the code to try by yourself.


<html>
<head>
    <title>Student information </title>
    
<script type="text/javascript">
    function calc()
    {
       form=document.getElementById("form1");
       sub1=form.sub1.value;
       sub2=form.sub2.value;
       sub3=form.sub3.value;
       sub4=form.sub4.value;
       // Find the total -- TypeCast the values of the textboxes to integer.
       total=parseInt(sub1)+parseInt(sub2)+parseInt(sub3)+parseInt(sub4);
       form.total.value= total; // display the total into textbox.
       form.avg.value= parseInt(total)/4; // typecast.
       // if any one sub is <35 then result is "Fail".
       if(sub1<35||sub2<35||sub3<35||sub4<35)
       { form.result.value="Fail";}
       else {form.result.value="Pass";}
        // Grading system.
       if(form.avg.value>90)
        {form.grade.value="A";}
       else if (form.avg.value>80 && form.avg.value<90)
        {form.grade.value="B";}
       else if (form.avg.value>70 && form.avg.value<80)
        {form.grade.value="C";}
       else if (form.avg.value>60 && form.avg.value<70)
        {form.grade.value="D";}
       else if (form.avg.value>=35 && form.avg.value<60)
        {form.grade.value="E";}
    }
</script>



</head>
<body>

<form id="form1"> Student information.<br /><br />

  Enter the Name :  <input type="text" size="20" name="name"/><br />
    
  Marks in sub1 :  <input type="text" size="20" name="sub1"/><br />

  Marks in sub2 :  <input type="text" size="20" name="sub2"/><br />

  Marks in sub3 :  <input type="text" size="20" name="sub3"/><br />

  Marks in sub4 :  <input type="text" size="20" name="sub4"/><br />

  
  <input type="button" name="btn" value="Calculate" onclick="calc()"/><br />
  Total : <input type="text" size="20" name="total"/><br />
  Average : <input type="text" size="20" name="avg"/><br />
  Result : <input type="text" size="20" name="result"/><br />
  Grade : <input type="text" size="20" name="grade"/><br />
  <input type="reset" name="Btn2" value="Reset"/>

  
</form>

</body>
</html>

Hope you enjoyed this, i will be publishing more in near future. For more programs and fun follow me in google plus i will be posting new programs soon.





Monday, April 4, 2016

Xampp Introduction.

Xampp is a free and open source web server solution package. This package specially consist with HTTP server specific Apache, MySQL and this is specially used for scripting programming language like PHP and perl programming language.

People more likely to use it to test their website as this allows user to get a web server, server application and database. It works on different platform whether is windows or Linux which is also the reason for its present day popularity.

Above that XAMPP is really easy to install and it's requirement are really low. All you need is full administration right and access to your windows firewall setting.  Furthermore to work with it you will also need an text editor (my own personal favourite is notepad++).
After the installation of xampp, you will see windows box  like above picture. Simply, you have click on what you need then you are good to go.
If you see some error on ports are being used then here is the tutorial on how to fix that:-