Solution:
<HTML>
<script>
function find()
{
var str=frm.txt1.value;
var n = str.length;
var i,ch,j;
for(i=0;i<n;i++)
{
str = str.replace(" ", "*");
str = str.replace(/[0-9]/g, "?")
}
alert(str);
}
</script>
<form name="frm">
Enter a String:<input name="txt1" type="text" />
<input name="b1" onclick="find();" type="button" value="display" /></form>
</BODY>
</HTML>
0 Comments