JavaScript String functions


Corel.com
sponsored ads
<html>
<head>
<title>Javascript Example</title>
<script>
function draw(opt)
{

 var st=new String("Tutorials by Kashid");

          switch (opt)
            {
             case 1:st=st.big();
                    break;                       
             
             case 2:st=st.small();
                    break;                        
             
             case 3:st=st.strike();
                    break;

    case 4:st=st.bold();
                    break;                       
             
             case 5:st=st.italics();
                    break;                        
             
             case 6:st=st.toLowerCase();
                    break;

             case 7:st=st.toUpperCase();
                    break;

              }
        

div1.innerHTML=st;

}
</script>

</head>

<body bgcolor='#cccfaa'>
<div id='div1'>Tutorials by Kashid</div>
<input type=radio name=r1 onclick="draw(1);"/>Big<br/>
<input type=radio name=r1 onclick="draw(2);" />Small<br/>
<input type=radio name=r1 onclick="draw(3);" />Strike<br/>
<input type=radio name=r1 onclick="draw(4);" />Bold<br/>
<input type=radio name=r1 onclick="draw(5);" />Italics<br/>
<input type=radio name=r1 onclick="draw(6);" />Lcase<br/>
<input type=radio name=r1 onclick="draw(7);" />Ucase<br/>
Font Color:<input type=radio name=r2 onclick="div1.style.color='green'" />Green
<input type=radio name=r2 onclick="div1.style.color='#FF6600'" />Orange

</body>
</html>

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training in India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog