Solved

replace page values

Posted on 2010-09-06
24
202 Views
Last Modified: 2013-11-19
hi,
i need some help in doing the following:

i have a tabel with the following data:

match 1            quest 1

ATD                   example data [PTD]
ATD                   example data [ATD]
ATD                   example data [ATD]
ATD                   example data [PTD]
ATD                   example data [PTD]

what i need to do is remove for example the [PTD] text in quest1 for blanks and if the data between [] is different from match1, change the text of match1 to the text between [] of quest1

this is the output i want to achieve

match 1            quest 1

PTD                   example data
ATD                   example data
ATD                   example data
PTD                   example data
PTD                   example data
0
Comment
Question by:eaweb
  • 12
  • 9
24 Comments
 

Author Comment

by:eaweb
Comment Utility
the text i match1 is coming like

 PTD 
 ATD 
etc...

I only need to change the PTD and ATD etc....
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
Check tis :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function cleanex(t) {
		var trs = document.getElementById(t).getElementsByTagName("tr");
		for(var i=0;i<trs.length;i++) {
			str = trs[i].cells(1).innerText.indexOf("[");
			end = trs[i].cells(1).innerText.indexOf("]");
			t0 = trs[i].cells(0).innerText;
			t1 = trs[i].cells(1).innerText.substring(str+1, end);
			alert(t1)
			if(t0!=t1) {
				trs[i].cells(0).innerText = t1;
				trs[i].cells(1).innerText = trs[i].cells(1).innerText.substr(0, str-1);
			}
//			trs[i].cells(1).innerText = trs[i].cells(1).innerText.substr(0, str-1);
		}
	}
</script>
</head>
<body onload="cleanex('myTable');">
<table id="myTable" border="1">
<tr><td>ATD</td><td>example data [PTD]</td></tr>
<tr><td>ATD</td><td>example data [ATD]</td></tr>
<tr><td>ATD</td><td>example data [ATD]</td></tr>
<tr><td>ATD</td><td>example data [PTD]</td></tr>
<tr><td>ATD</td><td>example data [PTD]</td></tr>
</table>
</body>
</html>

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
And this :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function cleanex(t) {
		var trs = document.getElementById(t).getElementsByTagName("tr");
		for(var i=0;i<trs.length;i++) {
			str = trs[i].cells(1).innerText.indexOf("[");
			end = trs[i].cells(1).innerText.indexOf("]");
			t0 = trs[i].cells(0).innerText;
			t1 = trs[i].cells(1).innerText.substring(str+1, end);
//			alert(t1)
			if(t0!=t1) {
				trs[i].cells(0).innerText = t1;
//				trs[i].cells(1).innerText = trs[i].cells(1).innerText.substr(0, str-1);
			}
			trs[i].cells(1).innerText = trs[i].cells(1).innerText.substr(0, str-1);
		}
	}
</script>
</head>
<body onload="cleanex('myTable');">
<table id="myTable" border="1">
<tr><td>ATD</td><td>example data [PTD]</td></tr>
<tr><td>ATD</td><td>example data [ATD]</td></tr>
<tr><td>ATD</td><td>example data [ATD]</td></tr>
<tr><td>ATD</td><td>example data [PTD]</td></tr>
<tr><td>ATD</td><td>example data [PTD]</td></tr>
</table>
</body>
</html>

Open in new window

0
 

Author Comment

by:eaweb
Comment Utility
hi leakim971,
i went to implement your script for below table data but without success as i am also using javascript function to format  some number if their are any.
what i want to change using your code is bolded and underlined. the one with id "invest i only need to remove the last [...]  part (it will always be the last part) as the txt can also contain it"
here the table data:

<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                         [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>
 
<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                         [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>
<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>
i hope you can help.
0
 

Author Comment

by:eaweb
Comment Utility
hi

the rows (tr) are being generated dynamically so if i can make it with two function will be great.
one javascript function that can remove the last [text] from the string so the  stripCostCurrency function can us it
one javascript function compare the text in the [text] with the text between the (&nbsp;) &nbsp;ATD&nbsp;. if they are the same the text between &nbsp; remain the same and if not the text between &nbsp; become the text in the [text].

like

stripCostCurrency(CompareRemoveText("MAEDROS VEARIS [PIT] CENTRE                          [PTD]")); remove the [PTD]

ReplaceText(&nbsp;ATD&nbsp;) replace ATD for PTD if the text in the function CompareRemoveText contains [PTD] and if it is the same like [ATD] the text will remain the same
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
What is your server-side scripting language?
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
>what i want to change using your code is bolded and underlined.

in cell(x), x is the column number. The first column number is zero.
In my example we've two columns : 0 and 1, so cell(0) and cell(1)
0
 

Author Comment

by:eaweb
Comment Utility
leamkin971,
i understood. but i also have a heading above the rows. i am testing but you code is only reading the first row (the heading). it not reading the hole table. see below the table sample i am using:

<table cellpadding="0" border="0" cellspacing="0" width="95%" id="myTable">
                   <tr valign=top>
                        <th id="stdAct" width="100">Date0</th>
                        <th id="stdAct">&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount2&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount4&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">Change6</th>
                        <th width="10">&nbsp;</th>
                        <th width="450" align="left">change Description8</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="right">Quantity10</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Type12</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Cost14</th>
                        <th id="invest" width="20">&nbsp;</th>
                        <th id="invest" align="right" colspan="2" width="200">Market&nbsp;Value16</th>
                        <th valign="top">&nbsp;</th>
                  </tr>
                  <tr><td colspan="14"><hr size="5"></td></tr>
                   <tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>                  
</table>
0
 

Author Comment

by:eaweb
Comment Utility
see below the modified code

unction cleanex(t) {
            var trs = document.getElementById(t).getElementsByTagName("tr");
            for(var i=0;i<trs.length;i++) {
                  str = trs[i].cells(8).innerText.indexOf("[");
                  end = trs[i].cells(8).innerText.indexOf("]");
                  t0 = trs[i].cells(6).innerText;
                  t1 = trs[i].cells(8).innerText.substring(str+1, end);
                  alert(trs.length)
                  alert(str)
                  alert(end)
                  alert(t0)
                  alert(t1)
                  if(t0!=t1) {
                        trs[i].cells(6).innerText = t1;
                        trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);
                  }
                  trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);
            }
      }

it not reading all the table rows. only the first row
0
 

Author Comment

by:eaweb
Comment Utility
with the heading row it give an error at ---str = trs[i].cells(8).innerText.indexOf("[");--- as there is no "[" or "]" in that cell.

what will happen if the text contains more []. is there a way to find the [text] starting from the back as the text that needs to be change will be always in the back like stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]");
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
could you post a generated page (right click on the page in the browser and choose view source)
thanks
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:eaweb
Comment Utility
i fix the reading starting from the back with "lastIndexOf" instead of IndexOf but, i still have the problem while reading the first row with the heading
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
Use : var trs = document.getElementById(t).getElementsByTagName("tbody")[0].getElementsByTagName("tr");
instead :  var trs = document.getElementById(t).getElementsByTagName("tr");
0
 

Author Comment

by:eaweb
Comment Utility
here is the code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<script language="javascript">

	function stripCostCurrency (srcStr) {

	var tmp = srcStr;

	//var acctType = '';

	//if (acctType == "") {

		//tmp = tmp.substring(0, tmp.length-3);

	//}

alert(tmp)

	document.write(tmp);

}

	

	

	function cleanex(t) {

		var trs = document.getElementById(t).getElementsByTagName("tr");

		for(var i=0;i<=trs.length;i++) {

			str = trs[i].cells(8).innerText.lastIndexOf("[");

			end = trs[i].cells(8).innerText.lastIndexOf("]");

			t0 = trs[i].cells(6).innerText;

			t1 = trs[i].cells(8).innerText.substring(str+1, end);

			alert(trs.length)

			alert(str)

			alert(end)

			alert(t0)

			alert(t1)

			if(t0!=t1) {

				trs[i].cells(6).innerText = t1;

				//trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);

			}

			trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);

		}

	}

	



</script>

</head>

<body onload="cleanex('myTable2');">





<table cellpadding="0" border="0" cellspacing="0" width="95%" id="myTable2">



<tr valign=top>

                        <th id="stdAct" width="100">Date0</th>

                        <th id="stdAct">&nbsp;</th>

                        <th id="stdAct" width="100" align="right">amount2&nbsp;</th>

                        <th id="stdAct" >&nbsp;</th>

                        <th id="stdAct" width="100" align="right">amount4&nbsp;</th>

                        <th id="stdAct" >&nbsp;</th>

                        <th id="stdAct" width="100" align="right">Change6</th>

                        <th width="10">&nbsp;</th>

                        <th width="450" align="left">change Description8</th>

                        <th id="invest" >&nbsp;</th>

                        <th id="invest" align="right">Quantity10</th>

                        <th id="invest" >&nbsp;</th>

                        <th id="invest" align="center">Type12</th>

                        <th id="invest" >&nbsp;</th>

                        <th id="invest" align="center">Cost14</th>

                        <th id="invest" width="20">&nbsp;</th>

                        <th id="invest" align="right" colspan="2" width="200">Market&nbsp;Value16</th>

                        <th valign="top">&nbsp;</th>

                  </tr>

                  <tr><td colspan="14"><hr size="5"></td></tr>





<tr class=RowEven>

<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>

<td >&nbsp;</td>

<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>

<td id="invest"  >&nbsp;</td>

<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>

<td >&nbsp;</td>

</tr>





<tr class=RowOdd>

<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>

<td >&nbsp;</td>

<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>

<td id="invest"  >&nbsp;</td>

<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>

<td >&nbsp;</td>

</tr>



<tr class=RowEven>

<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>

<td id="stdAct">&nbsp;</td>

<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>

<td >&nbsp;</td>

<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>

<td id="invest"  >&nbsp;</td>

<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>

<td id="invest" >&nbsp;</td>

<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>

<td >&nbsp;</td>

</tr> 



 

			

</table>



</body>

</html>

Open in new window

0
 

Author Comment

by:eaweb
Comment Utility
using
var trs = document.getElementById(t).getElementsByTagName("tbody")[0].getElementsByTagName("tr");
still give me an error at
str = trs[i].cells(8).innerText.lastIndexOf("[");
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
you need to put row(s) header of your table in < thead > ... < /thead> tags
and the other row(s) of your table in < tbody >... < /tbody >


<table cellpadding="0" border="0" cellspacing="0" width="95%" id="myTable2">
<thead>
<tr valign=top>
                        <th id="stdAct" width="100">Date0</th>
                        <th id="stdAct">&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount2&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount4&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">Change6</th>
                        <th width="10">&nbsp;</th>
                        <th width="450" align="left">change Description8</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="right">Quantity10</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Type12</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Cost14</th>
                        <th id="invest" width="20">&nbsp;</th>
                        <th id="invest" align="right" colspan="2" width="200">Market&nbsp;Value16</th>
                        <th valign="top">&nbsp;</th>
                  </tr>
                  <tr><td colspan="14"><hr size="5"></td></tr>
</thead>
<tbody>
<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>


<tr class=RowOdd>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>

<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr> 

</tbody>

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
full page :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function stripCostCurrency (srcStr) {
	var tmp = srcStr;
	//var acctType = '';
	//if (acctType == "") {
		//tmp = tmp.substring(0, tmp.length-3);
	//}
alert(tmp)
	document.write(tmp);
}
	
	
	function cleanex(t) {
		var trs = document.getElementById(t).getElementsByTagName("tbody")[0].getElementsByTagName("tr");
		for(var i=0;i<=trs.length;i++) {
			str = trs[i].cells(8).innerText.lastIndexOf("[");
			end = trs[i].cells(8).innerText.lastIndexOf("]");
			t0 = trs[i].cells(6).innerText;
			t1 = trs[i].cells(8).innerText.substring(str+1, end);
			alert(trs.length)
			alert(str)
			alert(end)
			alert(t0)
			alert(t1)
			if(t0!=t1) {
				trs[i].cells(6).innerText = t1;
				//trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);
			}
			trs[i].cells(8).innerText = trs[i].cells(8).innerText.substr(0, str-1);
		}
	}
	

</script>
</head>
<body onload="cleanex('myTable2');">


<table cellpadding="0" border="0" cellspacing="0" width="95%" id="myTable2">
<thead>
<tr valign=top>
                        <th id="stdAct" width="100">Date0</th>
                        <th id="stdAct">&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount2&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">amount4&nbsp;</th>
                        <th id="stdAct" >&nbsp;</th>
                        <th id="stdAct" width="100" align="right">Change6</th>
                        <th width="10">&nbsp;</th>
                        <th width="450" align="left">change Description8</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="right">Quantity10</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Type12</th>
                        <th id="invest" >&nbsp;</th>
                        <th id="invest" align="center">Cost14</th>
                        <th id="invest" width="20">&nbsp;</th>
                        <th id="invest" align="right" colspan="2" width="200">Market&nbsp;Value16</th>
                        <th valign="top">&nbsp;</th>
                  </tr>
                  <tr><td colspan="14"><hr size="5"></td></tr>
</thead>
<tbody>
<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>


<tr class=RowOdd>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr>

<tr class=RowEven>
<td id="stdAct" nowrap align="right" valign="top">14 Jan 2010</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top"> 128.47</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;</td>
<td id="stdAct">&nbsp;</td>
<td id="stdAct" nowrap align="right" valign="top">&nbsp;ATD&nbsp;</td>
<td >&nbsp;</td>
<td valign="top"><script type="text/javascript"> stripCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap align="right" valign="top"><div id="posQty"><script type="text/javascript"> roundNumber(formatNumbers(9465000, 3), 2).toFixed(2); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap valign="top" align="left"><div id="posTyp"><script type="text/javascript"> getType("MAEDROS ABBIT"); </script></div></td>
<td id="invest"  >&nbsp;</td>
<td id="invest" nowrap valign="top" align="right"><div id="posCst"><script type="text/javascript"> getCost("MAEDROS ABBIT"); </script>&nbsp;<script type="text/javascript"> printCostCurrency("MAEDROS VEARIS [PIT] CENTRE                          [PTD]"); </script></div></td>
<td id="invest" >&nbsp;</td>
<td id="invest" nowrap colspan="2" align="right"valign="top"><div id="posVal"><script type="text/javascript"> formatNumbers(-12847, 2); </script>&nbsp;ATD</div></td>
<td >&nbsp;</td>
</tr> 

</tbody>
			
</table>

</body>
</html>

Open in new window

0
 

Author Comment

by:eaweb
Comment Utility
Still getting the error
Webpage error details
Message: 'undefined' is null or not an object
Line: 354
Char: 4
this line is at --str = trs[i].cells(8).innerText.lastIndexOf("[");---

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
Replace : for(var i=0;i<=trs.length;i++) {
By : for(var i=0;i
0
 

Author Comment

by:eaweb
Comment Utility
Hi leakim971,

great thank you very very much.
0
 
LVL 82

Expert Comment

by:leakim971
Comment Utility
You're very welcome! Thanks for the points!
0
 

Author Comment

by:eaweb
Comment Utility
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now