Friday, June 5, 2009

How to use Text Wrap feature in Mozilla...

For using text wrap in Mozilla you need to perform following steps:


1. Create following javascript function :

function textwrap()
{
if (ie==0)
{
var tag = document.getElementsByTagName("span");
for (var i = 0; i < classname ="=" text_final =" tag.item(i).innerHTML;" re =" /(<([^">]+)>)/gi;
text_final = text_final.replace(re, "")

tag.item(i).innerHTML = text_final.replace(/(.*?)/g, "< wbr >");
}
}
}
}



-------------------------------------------------------------------------------------------

2.
Call textwrap() javascript function on your page and call it only for browser mozilla.....
Here I am assuming that you have already identified the browser type.....

textwrap();


3.
Apply the CSS class named "wraptext" to the label control who's text you want to wrap.
E.g. test.CssClass = "wraptext";


IE can handle word wrap with some CSS properties so there is no need to use above mentioned Javascript function. In case of IE we can simply use following CSS properties:

style="word-wrap: break-word; text-wrap: wrap;"

No comments:

Post a Comment