SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript String

JavaScript string object

JavaScript string object we can use with its different properties and methods to get various string formats and string types. We will discuss with some examples for better understanding.
Let us first declare a new string object like this.

<script type="text/javascript">
my_string= new String("Welcome to plus2net.com");
</script>

Length property to get the length of the string

It gives the total length of the string including blank spaces present in a string.

document.write(my_string.length);
Output: 23

Making the string Bold

document.write(my_string.bold());

Declaring the font size of the string

document.write(my_string.fontsize(6));

Making the string blink ( not work in IE )

document.write(my_string.blink());

Making TT type font with fixed

document.write(my_string.fixed());

Making the font color of the string

document.write(my_string.fontcolor("blue"));

Changing to Italic font

document.write(my_string.italics());

Adding a link to the string by link

document.write(my_string.link("http://www.plus2net.com"));

Making the font style strike out

Demo script using strike property
document.write(my_string.strike());

Getting a substring with start and end points

document.write(my_string.substring(10,15));

Making sub script

document.write(my_string.sub());

Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked




Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer