Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've created a VB script which connects to a web page and generates a HTML table with several fields. I want to fetch one particular field value by giving the corresponding another field value.

example: suppose below is the table.

column1 column2 column3 column4
a101 100 04:00 05:00
a102 102 05:00 03:00


So I need to fetch only column3 value for a101 using VB script.

I've tried document.getElementById(columnname).innerHTML but it didn't work.

Please help me out.
Posted
Comments
joshrduncan2012 31-Jul-13 13:33pm    
Can you tell us why innerHTML didn't work?

XML
<html><head><title></title>


<script type="text/javascript">

function a(){


var aa =  document.getElementById("aw").getElementsByTagName("tr")[0].getElementsByTagName("td")[2];

alert(aa.innerHTML);



}

</script>

</head>

<body onload="javscript:a();">


<table id="aw">
<tr><td >name</td><td>age</td><td>sex</td></tr>
<tr><td>marut</td><td>20</td><td>Male</td></tr>
<tr><td>abhishek</td><td>20</td><td>Male</td></tr>
</table>
</body>
</html>
 
Share this answer
 
Why not generate individual ids for the cells and then call them that way. for each
in your table assign it an id "r#c#". In this scenario you would be looking for
or
based on how you do your numbering. Then all you would need to do is document.getElementById('r#c#').innerHTML.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900