Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


debasis
javascript,jsp
1 Answer(s)      4 years and 5 months ago
Posted in : Design concepts & design patterns


Dear Sir,
I have a code which is not working properly.It is as follows.

function calcMinValue(){
var Val="",minValue=9999;
Val=document.pagename.txtbox1Id.value;
if(Val!= ""){
if(Val<minValue){
document.pagename.txtbox4Id.value = Val;
minValue=Val;
}
}
Val=document.pagename.txtbox2Id.value;
if(Val!= ""){
if(Val<minValue){
document.pagename.txtbox4Id.value = Val;
minValue=Val;
}
}
Val=document.pagename.txtbox3Id.value;
if(Val!= ""){
if(Val<minValue){
document.pagename.txtbox4Id.value = Val;
}
}

}

To call this function i have given the following codes in their respective 3 text boxes

onkeyup="javascript:isNumeric(this.id,this.value)"
onblur="javascript:calcMinValue()"
But problem is cited with an e.g:When i am entering in 1st box=150,2nd box=200,3rd box=90
It must show 90 in the 4th textbox but it is showing 150 in the 4th textbox.

It is very urgent and deadline is today.Please help me.
Thank You.
Regards
Debasis

Advertisement
View Answers

July 30, 2010 at 1:37 PM


Hi Friend,

Try the following code:

<script>
function calcMinValue(){
var Val1=Number(document.pagename.txtbox1Id.value);
var Val2=Number(document.pagename.txtbox2Id.value);
var Val3=Number(document.pagename.txtbox3Id.value);

if(Val1<Val2 && Val1<Val3){
document.pagename.txtbox4Id.value = Val1;
}
if(Val2<Val1 && Val2<Val3){
document.pagename.txtbox4Id.value = Val2;
}
if(Val3<Val1 && Val3<Val2){
document.pagename.txtbox4Id.value = Val3;
}

}

</script>
<form name="pagename">
<input type="text" name="txtbox1Id" onkeyup="javascript:calcMinValue();">
<input type="text" name="txtbox2Id" onkeyup="javascript:calcMinValue();">
<input type="text" name="txtbox3Id" onkeyup="javascript:calcMinValue();">
<input type="text" name="txtbox4Id">
</form>

Thanks


Related Tutorials/Questions & Answers:
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think it might be a short solution.How can i get the navigation link whilr traversing
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think it might be a short solution.How can i get the navigation link whilr traversing
Advertisements
Javascript & jsp
Javascript & jsp  Dear Sir, Thanks a ton for all your answers throughout.I asked this question long ago.This time i nedd it very urgent.I think it might be a short solution.How can i get the navigation link whilr traversing
Javascript & jsp
Javascript & jsp  Dear Sir, I have a table which has records relating to student name,roll no,sex,subject.address. I have a dropdown list which has...*"%> <html> <head> <script type="text/javascript"> function
Implementing CSS and JavaScript in JSP File
Implementing CSS and JavaScript in JSP File... and JavaScript in jsp. Here we have created three main files.... <script language="JavaScript" type="text/JavaScript" src="../script
javascript - JSP-Servlet
javascript  how to convert a string to long in javascript
javascript - JSP-Servlet
javascript  hi sir.i am preparing one application in jsp which contains 10 rows,each row contains 2 fields,2 fields are droop down list box,in these controls am getting values from database when form is requested.i.eretrieving 3
javascript - JSP-Interview Questions
javascript open new window popup  How to open new window in popup view using JavaScript?  hi friend,<html><title>new window page</title><head></head><body><FORM><INPUT type
javascript - JSP-Interview Questions
Javascript string functions contains  What is the Javascript string functions contains
javascript - JSP-Servlet
javascript  how to generate html table in current jsp page with other form fields with given value in text field.i want to generate subject course table in existing form (which already contains some textfield) each row contains
jsp,javascript - JSP-Servlet
jsp,javascript   Hi, I want to retrieve record and move it. Can any body tell me what is the problem with this code Deparment function update(s) { alert(s); if (s==0) { alert("pr
javascript - JSP-Servlet
javascript  i dont have the jsp code . using simple jsp file and without using alert message box.i need using of getElementByID
javascript - JSP-Servlet
;i dont have the jsp code . using simple jsp file and without using alert
javascript - JSP-Servlet
Disabled JavaScript on Browser  How can i disabled JavaScript for a particular browser
How to get the text from textarea in HTML and store it in database using javascript and jsp
How to get the text from textarea in HTML and store it in database using javascript and jsp  How to get the text from textarea in HTML and store it in database using javascript and jsp <script> function str() { <
unicode support in javascript - JSP-Servlet
the tha text in a text box and sending it to next jsp. we are using UTF-8 encoding for jsp and charset as windows-874 for html meta charset. Can anybody help me... to server functionality We are already using encodingfor jsp 1)and client
Servlets,Jsp,Javascript - JSP-Servlet
Servlets,Jsp,Javascript  Hi in my application i am creating a file... ExportToExcel button, jsp Upload plot nos (.xls format). GO Reset ExportToExcel javascript function excelExport() { document.body.style.cursor="wait
Dynamic row genertion in javascript? - JSP-Servlet
Dynamic row genertion in javascript?  Hi roseindia, I want coding in javascript to add a dynamic row in jsp..This row contain 3 fields(2 textfields,1 textarea).Every time if i click add button have to add dynamically
provide code in servlets,javascript,jsp - JavaMail
provide code in servlets,javascript,jsp  i create mail like fallowing subject:TEXTFEILD Email:TEXTAREA FOOTER:TEXTFEILD >here some radiobuttons as fallowing .coformation .cancellatin mail .waitinglist mail if i
Read Text file from Javascript - JSP-Servlet
Read Text file from Javascript  plz send the code How to Retrieve the data from .txt file thru Javascript? And how to find the perticular words in that file
javascript,jsp - Design concepts & design patterns
javascript,jsp  Dear Sir, I have a code which is not working properly.It is as follows. function calcMinValue(){ var Val="",minValue=9999; Val=document.pagename.txtbox1Id.value; if(Val!= ""){ if(Val  
passing values form javascript - JSP-Interview Questions
passing values form javascript  please i want to pass values from javascript function to jsp code how can i do
Call servlet from javascript - JSP-Servlet
Call servlet from javascript  Hi in my application i have jsp that designs view, javascript for validation and servlet that perform business logic , in my jsp i have provided an upload button thet upload single column excel file
Advertisements
 

 

 

DMCA.com