var temp = getElementsByClassName('daniweb');
If you paste the contents of the $data var, it might shine some light on this. As for the position of the script, I've moved to placing nearly everything just before the closing </body> tag of the html - far less hassle that way.
however even though $data is echoed, its technically not part of the document
Why not? Whether it's generated by php or 'hard markup' it should still be valid html when it leaves the server - indistingushable form one another.
diafol
Keep Smiling
10,655 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,511
Skill Endorsements: 57
Hmm, what browser are you using? If IE8 or previous, you're out of luck I think. It's not reliable: http://caniuse.com/getelementsbyclassname
It works fine in Chrome:
<html>
<body>
<table>
<tr class="daniweb">Hi</div>
<tr class="daniweb">Sup</div>
</table>
<script type="text/javascript">
var temp = getElementsByClassName('daniweb');
document.write(temp);
</script>
</body>
</html>
//EDIT
What I don't understand is that you have <html> and <body> tags in the $data var, but you have other hard-coded html elements outside it. That isn't right.
diafol
Keep Smiling
10,655 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,511
Skill Endorsements: 57