<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script>
function cal() {
var r1=document.forms[0];
var a=document.frm.txt.value;
var repeat=0;
var c;
var pos=prompt("Enter Position: ");
var ch=a.charAt(parseInt(pos)-1);
if(ch!="")
alert("character at specified position is: "+ch);
else
alert("Please Enter value between "+ a.length);
}
</script>
<form name="frm">
Enter the string: <input type="text" name="txt" ><br/>
<input type="button" onclick ="cal()" name="b1" value="Submit">
</form>
</body>
</html>