JavaScript e Ajax

Page 96

Learn JavaScript and Ajax with w3schools

Examples The following example shows how to return the length of a string. Your results are shown in Figure 15.1.

Try it yourself >> <html> <body> <script type="text/javascript"> var txt = "Hello World!"; document.write(txt.length); </script> </body> </html>

Figure 15.1

The following example demonstrates how to use the methods of the String object to style strings. Your results are shown in Figure 15.2.

Try it yourself >> <html> <body> <script type="text/javascript"> var txt = "Hello World!";

82


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.