Automatic calculate without button in NetBeans

  • ultimate11
  • Student
  • Student
  • ultimate11
  • Posts: 86

Post 3+ Months Ago

guys..gud day..who knows to calculate 2 txtfield in netbeans without clicking a button..a dynamic total..
Code: [ Select ]
 num1=Integer.parseInt(txtfield1.getText());
num2=Integer.parseInt(txtfield2.getText());
total=num1*num2;
totalField.setText(String.valueOf(total));
  1.  num1=Integer.parseInt(txtfield1.getText());
  2. num2=Integer.parseInt(txtfield2.getText());
  3. total=num1*num2;
  4. totalField.setText(String.valueOf(total));
  • Mustafa_Aslan
  • Beginner
  • Beginner
  • Mustafa_Aslan
  • Posts: 38

Post 3+ Months Ago

Code: [ Select ]
<script type="text/javascript">
function calculate()
{
    var val1=document.form1.txt1.value;
    var val2=document.form1.txt2.value;
    var valT=(val1*1)+(val2*1);
  document.getElementById("result").innerHTML=valT;
}
</script>
</head>
<body>
<form name="form1">
<input type="text" name="txt1" onBlur='calculate()'><br>
<input type="text" name="txt2" onBlur='calculate()'><br>
<div id="result"></div>
</form>
  1. <script type="text/javascript">
  2. function calculate()
  3. {
  4.     var val1=document.form1.txt1.value;
  5.     var val2=document.form1.txt2.value;
  6.     var valT=(val1*1)+(val2*1);
  7.   document.getElementById("result").innerHTML=valT;
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <form name="form1">
  13. <input type="text" name="txt1" onBlur='calculate()'><br>
  14. <input type="text" name="txt2" onBlur='calculate()'><br>
  15. <div id="result"></div>
  16. </form>
  • ultimate11
  • Student
  • Student
  • ultimate11
  • Posts: 86

Post 3+ Months Ago

onBlur will serves as a button that will trigger the script to run in javascript..but my point is how to automatic calculate in java netbeans..
  • Mustafa_Aslan
  • Beginner
  • Beginner
  • Mustafa_Aslan
  • Posts: 38

Post 3+ Months Ago

Your topic is "automatic calculate without button" not in java netbeans.
  • ultimate11
  • Student
  • Student
  • ultimate11
  • Posts: 86

Post 3+ Months Ago

its in java netbeans..automatic calculate and not in javascript
  • Mustafa_Aslan
  • Beginner
  • Beginner
  • Mustafa_Aslan
  • Posts: 38

Post 3+ Months Ago

Dear Ultimate,

I understand that. But the "topic" you posted reads "automatic calculate without button", does it say anything about netbeans? No...

It is only mentioned one time, in the body of message, which I saw after your reply.

Neverthless, I apologize for trying to help you out.

Regards,

Mustafa
  • ultimate11
  • Student
  • Student
  • ultimate11
  • Posts: 86

Post 3+ Months Ago

can you make it in netbeans..?

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 93 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.