Solved

Regular expressions and an adding function... WHOPPING 500 points... who wants it?!?

Posted on 2003-11-03
16
213 Views
Last Modified: 2008-03-10
All,

This problem is really annoying me.

I have a HTML page (well, I have a couple of them) and on these pages there are a number of Input textboxes.  There is a couple of things I need/want them to do.

1.  When the page loads up, I need them to populate with information from a function that I have already set up.

2.  Also, when the page loads, I need to then add up all the values in these textboxes so that I get a total.

3.  If a user enters a textbox and then leaves, I need to make the textbox display the original value (which could either come from the original function in 1 above, or be '0')

4.  The names of these textboxes are set at 'newValueX', where X is a number dependant on the page and the textbox in question.

I have copied the part of the code that I am having a problem with below:

<FORM name="aForm">
<TABLE cellpadding="1" cellspacing="4" width="100%">
<TBODY>
<TR bgcolor="#cccccc">
<TD align="left" colspan="5">NAME</TD>

<TD align="left">STUFF</TD>

</TR>

<TR bgcolor="#cccccc">
<TD align="left" width="13%>AAA<TD>
<TD align="left" width="13%">BBB</TD>
<TD align="left" width="13%">CCC</TD>
<TD align="left" width="20%">DDD</TD>
<TD align="left" width="20%">EEE</TD>
<TD align="left" width="20%">FFF</TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME2</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%<INPUT type="text" size="8" maxlength="8" value=0 name="newValue2" onfocus="value=''" onblur='if (value=="") value="0"; javascript:addLumpSumValues();'></SPAN></TD>
</TR>


<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME3</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%<INPUT type="text" size="8" maxlength="8" value=0 name="newValue3" onfocus="value=''" onblur='if (value=="") value="0"; javascript:addLumpSumValues();'></SPAN></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME4</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%<INPUT type="text" size="8" maxlength="8" value=0 name="newValue4" onfocus="value=''" onblur='if (value=="") value="0"; javascript:addLumpSumValues();'></SPAN></TD>
</TR>

<TR>                                                
<TD align="right">
<TABLE>
<TBODY>
<TR>
<TD align="right">GBP</TD>
<TD align="right"><INPUT type="text"      size="8" maxlength="8" name="total" readonly value="0"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>


AND THE ADDING FUNCTION:

function addLumpSumValues()
{
var search = new RegExp("/ \bnewValue\b /");
var count=document.getElementsByName(search);
var countloop = count.length;
var totalval = 0;

for (i=2;i<countloop;i++)
{
   searchTEXT = "newValue" + i
   if(document.aForm.elements[i].name == searchTEXT)
   {
     theVal=document.aForm.elements[i].value;
     var Y = parseInt(theVal);
     totalval = totalval + Y;
     totalval.toPrecision(2;
   }
   else
   {
   countloop = countloop + 1
   }
   document.aForm.total.value = totalval
}
}


**********************************************

500 points (or a share of them), to anyone who can help out on this one...
0
Comment
Question by:squish2307
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
  • +1
16 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9671428
This line

     totalval.toPrecision(2;

Should be this

     totalval.toPrecision(2); // You forgot the  ending )

and this

<TD align="left" width="13%>AAA<TD>

Should be this
<TD align="left" width="13%">AAA</TD>



0
 
LVL 25

Assisted Solution

by:James Rodgers
James Rodgers earned 200 total points
ID: 9671483
to poulate the textboxes on load you will need to use the onload event of the document

<body onload="populateFunction(); addLumpSumValues()">

need this expalined more

If a user enters a textbox and then leaves, I need to make the textbox display the original value (which could either come from the original function in 1 above, or be '0')
if you need to keep the values as set by your onload populate function you could make the textboxes readonly
<input type="text" name="newValueX" value="" readonly>
and/or once the user leaves teh textbox use the onBlur event to rerun the populate function

<input type="text" name="newValueX" value="" readonly onBlur="populateFunction()">

I need you to clarify the requirements for 3 + 4
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9671513
Agree with jester clarification
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:squish2307
ID: 9671586
JaySolomon... they were both typos.  Sorry.

Jester_48,

I was considering a 'populateFunction' at the beginning.  But it would need a couple of parameters to be sent to the function.  Which shouldn't be a problem, until the numbering goes out of kilter (which IS a problem).

with regards to your suggestion of 'readonly', this is NOT viable.  The idea is for a user to enter a number into the textboxes and this is then totaled.  So when they enter the text box it clears the contents and the user enters a new number.  BUT, if they leave it empty, it should refill with the original number.  I won't be able to use the populateFunction as mentioned in the previous paragraph as the user would loose all numbers entered up to that point (with me?) and thus have to start again.

Requirement 3 is answered above.

Requirement 4, this relates to the naming convention of the textboxes, eg "name = newValue3".  I have 4 similar pages, but the textboxes are numbered relating to the information that they will contain.  Hence the numbers will be different on page 2, 3 etc.

I hope this helps.

Thanks guys...

0
 
LVL 10

Assisted Solution

by:NetGroove
NetGroove earned 300 total points
ID: 9671618
Here afirst approach:

<html>
<head>
<script>
function addLumpSumValues(theField) {
 if(isNaN(theField.value)){
   theField.value = "0";
 }
 theField.value*=1;
 var totalval = 0;
 for (i=2;i<5;i++){
   theVal=document.aForm["newValue" + i].value;
   var Y = parseInt(theVal);
   totalval = totalval + Y;
   totalval.toPrecision(2);
 }
 document.aForm.total.value = totalval
}

</script>
</head>
<body>
<FORM name="aForm">
<TABLE cellpadding="1" cellspacing="4" width="100%">
<TBODY>
<TR bgcolor="#cccccc">
<TD align="left" colspan="5">NAME</TD>

<TD align="left">STUFF</TD>

</TR>

<TR bgcolor="#cccccc">
<TD align="left" width="13%>AAA<TD>
<TD align="left" width="13%">BBB</TD>
<TD align="left" width="13%">CCC</TD>
<TD align="left" width="20%">DDD</TD>
<TD align="left" width="20%">EEE</TD>
<TD align="left" width="20%">FFF</TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME2</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue2" onfocus="this.value=''" onblur='addLumpSumValues(this);'></SPAN></TD>
</TR>


<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME3</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue3" onfocus="this.value=''" onblur='addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME4</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value="0" name="newValue4" onfocus="this.value=''" onblur='addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR>                                        
<TD align="right">
<TABLE>
<TBODY>
<TR>
<TD align="right">GBP</TD>
<TD align="right"><INPUT type="text"     size="8" maxlength="8" name="total" readonly value="0"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>

</body>
</html>



0
 
LVL 10

Assisted Solution

by:NetGroove
NetGroove earned 300 total points
ID: 9671640
And here the second approach:


<html>
<head>
<script>
function addLumpSumValues(theField) {
 if(isNaN(theField.value)){
   theField.value = "0";
 }
 theField.value*=1;
 var totalval = 0;
 for (i=2;i<5;i++){
   theVal=document.aForm["newValue" + i].value;
   var Y = parseInt(theVal);
   totalval = totalval + Y;
   totalval.toPrecision(2);
 }
 document.aForm.total.value = totalval
}

</script>
</head>
<body>
<FORM name="aForm">
<TABLE cellpadding="1" cellspacing="4" width="100%">
<TBODY>
<TR bgcolor="#cccccc">
<TD align="left" colspan="5">NAME</TD>

<TD align="left">STUFF</TD>

</TR>

<TR bgcolor="#cccccc">
<TD align="left" width="13%>AAA<TD>
<TD align="left" width="13%">BBB</TD>
<TD align="left" width="13%">CCC</TD>
<TD align="left" width="20%">DDD</TD>
<TD align="left" width="20%">EEE</TD>
<TD align="left" width="20%">FFF</TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME2</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue2" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>


<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME3</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue3" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME4</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value="0" name="newValue4" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR>                                        
<TD align="right">
<TABLE>
<TBODY>
<TR>
<TD align="right">GBP</TD>
<TD align="right"><INPUT type="text"     size="8" maxlength="8" name="total" readonly value="0"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>

</body>
</html>




0
 
LVL 25

Assisted Solution

by:James Rodgers
James Rodgers earned 200 total points
ID: 9671648
these seem contradictory

>>When the page loads up, I need them to populate with information from a function that I have already set up

>>I was considering a 'populateFunction' at the beginning.  But it would need a couple of parameters to be sent to the function.  Which shouldn't be a problem, until the numbering goes out of kilter (which IS a problem).

what numbering?
 you could try this to add up your newValue text boxes

function addLumpSumValues(){
var search = new RegExp("/ \bnewValue\b /");
var count=document.getElementsByName(search);
var totalval = 0;
for (i=0;i<count;j++) {
       if (document.aForm.elements['newValue'+i].value!='')
         totalval += document.aForm.elements['newValue'+i].value;
     }
      
      
}
document.aForm.total.value = totalval
}


populateFunction(objTxt){

}
0
 
LVL 10

Assisted Solution

by:NetGroove
NetGroove earned 300 total points
ID: 9671670
And here some parametrazation:

<html>
<head>
<script>
var fieldPrefix = "newValue";
var firstFieldNum = 2;
var lastFieldNum = 4;
function addLumpSumValues(theField) {
 if(isNaN(theField.value)){
   theField.value = "0";
 }
 theField.value*=1;
 var totalval = 0;
 for (i=firstFieldNum;i<=lastFieldNum;i++){
   theVal=document.aForm[fieldPrefix + i].value;
   var Y = parseInt(theVal);
   totalval = totalval + Y;
   totalval.toPrecision(2);
 }
 document.aForm.total.value = totalval
}

</script>
</head>
<body>
<FORM name="aForm">
<TABLE cellpadding="1" cellspacing="4" width="100%">
<TBODY>
<TR bgcolor="#cccccc">
<TD align="left" colspan="5">NAME</TD>

<TD align="left">STUFF</TD>

</TR>

<TR bgcolor="#cccccc">
<TD align="left" width="13%>AAA<TD>
<TD align="left" width="13%">BBB</TD>
<TD align="left" width="13%">CCC</TD>
<TD align="left" width="20%">DDD</TD>
<TD align="left" width="20%">EEE</TD>
<TD align="left" width="20%">FFF</TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME2</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue2" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>


<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME3</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue3" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME4</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value="0" name="newValue4" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR>                                        
<TD align="right">
<TABLE>
<TBODY>
<TR>
<TD align="right">GBP</TD>
<TD align="right"><INPUT type="text"     size="8" maxlength="8" name="total" readonly value="0"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>

</body>
</html>



0
 

Author Comment

by:squish2307
ID: 9671677
NetGroove,

that is fine, however, the function must be universal.  Hence in my original function I use, getElementsbByName(search).  This then gives me the 'upper bound' of the for loop.  I CANNOT have the upperbound hardcoded.  It is no-good to me, especially when I am using the same code in a number of pages of differing length.
0
 

Author Comment

by:squish2307
ID: 9671720
NetGroove, disregard my last comment.
0
 

Author Comment

by:squish2307
ID: 9671888
OK...

how comes the RegExp doesn't work?

NetGroove, thanks for your help.  It works, however, on a page I may have the following scenario:

<input name = newValue3>
<input name = newValue4>
<input name = newValue12>
<input name = newValue23>
<input name = newValue3>

Hence the use of the RegExp.


I know I am being a pain, but please stay with me.  It is difficult to show you exactly what I am trying to achieve using the internet.
0
 

Author Comment

by:squish2307
ID: 9671894
OH...

Could the fact the RegExp doesn't work have anything to do with the fact that all my functions are in a '.js' file which I load up at the beginning?
0
 
LVL 10

Accepted Solution

by:
NetGroove earned 300 total points
ID: 9672209
I did not understood your problem with regexp, but how about checking for name prefix?
Like this:

<html>
<head>
<script>
var fieldPrefix = "newValue";
function addLumpSumValues(theField) {
 if(isNaN(theField.value)){
   theField.value = "0";
 }
 theField.value*=1;
 var totalval = 0;
 elem = theField.form.elements;
 for (i=0;i<elem.length;i++){
   if((elem[i].name+'').substr(0,fieldPrefix.length)==fieldPrefix){
     theVal=elem[i].value;
     var Y = parseInt(theVal);
     totalval = totalval + Y;
     totalval.toPrecision(2);
   }
 }
 document.aForm.total.value = totalval
}

</script>
</head>
<body>
<FORM name="aForm">
<TABLE cellpadding="1" cellspacing="4" width="100%">
<TBODY>
<TR bgcolor="#cccccc">
<TD align="left" colspan="5">NAME</TD>

<TD align="left">STUFF</TD>

</TR>

<TR bgcolor="#cccccc">
<TD align="left" width="13%>AAA<TD>
<TD align="left" width="13%">BBB</TD>
<TD align="left" width="13%">CCC</TD>
<TD align="left" width="20%">DDD</TD>
<TD align="left" width="20%">EEE</TD>
<TD align="left" width="20%">FFF</TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME2</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue2" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>


<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME3</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value=0 name="newValue3" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD colspan="5" align="left">NAME4</TD>
<TD colspan="1" align="left"><IMG src="../image/roundbutton.gif" width="18" height="18" border="0"> <A href="#" accesskey="v">View (V)</A></TD>
</TR>

<TR bgcolor="#eeeeee">
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="13%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%">NUM</TD>
<TD align="right" width="20%"><INPUT type="text" size="8" maxlength="8" value="0" name="newValue4" onfocus="this.oldValue=this.value;this.value=''" onblur='if(this.value=="")this.value=this.oldValue;addLumpSumValues(this);'></SPAN></TD>
</TR>

<TR>                                        
<TD align="right">
<TABLE>
<TBODY>
<TR>
<TD align="right">GBP</TD>
<TD align="right"><INPUT type="text"     size="8" maxlength="8" name="total" readonly value="0"></TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>

</body>
</html>



0
 

Author Comment

by:squish2307
ID: 9678196
I am going to split the points.  I have worked out a way that I can do this, but you guys gave me a lot of input.  I have marked the answers which I found were helpful.

Thanks.

Also, apologies for the question and for being quite hard to understand.
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9678218
thanks for the points!
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9678220
Thanks for the points.

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question