FALLSEM2019-20 ITE1002 ETH VL2019201002518 Reference Material II 26-Aug-2019 Stringmethods Example Code
FALLSEM2019-20 ITE1002 ETH VL2019201002518 Reference Material II 26-Aug-2019 Stringmethods Example Code
2 <script language="javascript">
3 /*function x(z,t,u)
4 {
5 //alert(x.length);
6 document.write(Math.round(-20.51));
7 document.write(parseFloat(9+10));
8 var qpt= new Array();
9 qpt[0] = "WebDevelopment";
10 qpt[1]="ApplicationDevelopment"
11 qpt[2]="Testing"
12 qpt[3] = "QualityPointTechnologies";
13 document.write(qpt[0,1,2,3]);
14 var x=103,y=9;
15 x%=y;
16 document.write(x);
17
18 }*/
19 </script>
20 <body>
21 <script type="text/javascript">
22
23 var txt="Hello world!";
24 document.write(txt.length); //12
25 document.write(txt.toUpperCase()); //HELLO WORLD!
26 document.write(txt.match("world") ); //world
27 document.write(txt.match("World") ) ;//null
28 document.write(txt.indexOf("world")); //6
29 var str="Visit Microsoft!";
30 document.write(str.replace("Microsoft","CTS")); //Visit CTS!
31 var txt = "Hello World!";
32 document.write("<p>Big: " + txt.big() + "</p>");
33 document.write("<p>Small: " + txt.small() + "</p>");
34 document.write("<p>Bold: " + txt.bold() + "</p>");
35 document.write("<p>Italic: " + txt.italics() + "</p>");
36 document.write("<p>Strike: " + txt.strike() + "</p>");
37 document.write("<p>Fontcolor: " + txt.fontcolor("green") + "</p>");
38 document.write("<p>Fontsize: " + txt.fontsize(6) + "</p>");
39 document.write("<p>Subscript: " + txt.sub() + "</p>");
40 document.write("<p>Superscript: " + txt.sup() + "</p>");
41 document.write("<p>Link: " + txt.link("http://www.w3schools.com") + "</p>");
42 document.write("<p>Blink: " + txt.blink() + " (does not work in IE, Chrome, or
Safari)</p>");
43 /*var s= "Good 100%";
44 var pattern = /oo/g;
45 var output= s.match(pattern);
46 //document.write(output);*/
47 </script>
48 <input type="button" value=click onclick=x(4,5,44)>
49 </body>
50 </html>
51
52
53
54
55
56
57
58
59