<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var str = document.getElementById("txtVal").value;
var desiredchar = '@';
var temp;
var arr = new Array();
for (var i = 0; i <= str.length - 1; i++) {
arr[i] = str.charAt(i);
}
for (j = 0; j <= str.length - 1; j++) {
if (arr[j] == 'a') {
temp = arr[j];
arr[j] = desiredchar;
desiredchar = temp;
}
arr[j];
}
for (k = 0; k <= str.length - 1; k++) {
document.write(arr[k]);
}
}
</script>
</head>
<body>
<input type="text" id="txtVal" />
<input type="button" value="Submit" onclick="f1()" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function f1() {
var str = document.getElementById("txtVal").value;
var desiredchar = '@';
var temp;
var arr = new Array();
for (var i = 0; i <= str.length - 1; i++) {
arr[i] = str.charAt(i);
}
for (j = 0; j <= str.length - 1; j++) {
if (arr[j] == 'a') {
temp = arr[j];
arr[j] = desiredchar;
desiredchar = temp;
}
arr[j];
}
for (k = 0; k <= str.length - 1; k++) {
document.write(arr[k]);
}
}
</script>
</head>
<body>
<input type="text" id="txtVal" />
<input type="button" value="Submit" onclick="f1()" />
</body>
</html>
No comments:
Post a Comment