Splitting name.. javascript
<html>
<head>
<title> Experiment No 6(c 1) </title>
<script type="text/javascript">
function SplitName()
{
var myName = prompt("Enter Your complete name: ");
var mySplitName = myName.split(" ");
for(i = 0; i < mySplitName.length; i++)
{
document.write("<br />*** " +mySplitName[i]+"*** having length of "+ mySplitName[i].length + "characters");
}
}
</script>
</head>
<body>
<center>
<h5>Implement a javascript by using string object enter a complete name ,find out the length of string & 1st name ,last name & middle name</h5>
<form>
<input type="button" value="Split My Name" onclick="SplitName()">
</form>
</center>
</body>
</html>
No comments:
Post a Comment