Friday, October 17, 2014

Write A program to use of String Function in javascript.(using all string method)


Write A program to use of String Function in javascript.(using all string method)
Code : stringfun3.html

<html>
<head>
<title> string function </title>
<style type="text/css">
.body
{
background:green;
color:violet;
font-size:35px;
line-height:180%;
}
</style>
<script type="text/javascript">
varstr="Hello World";
</script>
</head>
<body class="body">
<script type="text/javascript">
document.write("<br>charAt() : ");
document.write(str.charAt(8));
document.write("<br>Search() : ");
document.write(str.search("or") + " and ");
document.write(str.search("L"));
document.write("<br> Replace() : ");
document.write(str.replace("World","Good Morning"));
document.write("<br> Slice() : ");
document.write(str.slice(4,9));
document.write("<br>Substr() : ");
document.write(str.substr(8));
document.write("<br>SubString () : ");
document.write(str.substring(3,7)+ " and ");
document.write(str.substring(10));
document.write("<br>indexOf () : ");
document.write(str.indexOf("o",5)+ " and ");
document.write(str.indexOf("rl")+ " and ");
document.write(str.indexOf("Rl"));
document.write("<br>lastIndexOf() : ");
document.write(str.lastIndexOf("o",5)+ " and ");
document.write(str.lastIndexOf("rl"));
document.write("<br>fontcolor() : ");
document.write(str.fontcolor("blue"));
document.write("<br>fontsize() : ");
document.write(str.fontsize(7));
</script>
</body>
</html>

No comments: