'this' is only available within inline JavaScript (onclick="", onmouseover="", etc) - it can't be used inside a function, even if that function was called from inline JavaScript.
Although 'this' isn't available within the function, you can always pass 'this' to the function and use it as you would expect:
Code:
function removePolicy(this)
{
var policies = document.getElementById("policies")
var lis = policies.getElementsByTagName("li")
for (var i = 0; i < lis.length; i++)
{
if (i == this.value.substr(6))
{
policies.removeChild(lis[i])
}
}
}
<ul id="policies">
<li>
<input type="text" name="poli_numbs[]" value="policy1">
<input type="text" name="poli_files[]" value="policy1.pdf">
<button name="poli_remov1" onclick="removePolicy(this)">Remove1</button>
</li>
</ul> Hope that helps :)