Are you trying to test to see if a control exists so you can perform an action if it does? If so try something like this...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<span id="ctl00_chMaster_ctl04_txtPayAmount">my control text</span>
<script type="text/javascript">
// the fourth loop should return true all others should return false
for(var i =1;i <= 5;i++){
if(document.getElementById("ctl00_chMaster_ctl0" + i + "_txtPayAmount") != null){
window.alert(true);
}
else {
window.alert(false)
}
}
</script>
</body>
</html>