...

View Full Version : Convert html tags to Lower Case



90January
06-01-2005, 06:53 AM
I have a string, for example str="<P ALIGN='LEFT'>In this I don't want to change to the lower case</P>";

I want to change all html tag and its attributes or properties to the lower cas, but not the text inside the html tag.
I mean that str="<p align='left'>In this I don't want to change to the lower case</p>"

Hope you can help me.

Philip M
06-01-2005, 08:41 AM
This should work:-

<SCRIPT>
function changeIt()
{
str="<P ALIGN='LEFT'>In this I don't want to change to the lower case</P>"
var ssa = str.split(">");
ssa[0] = ssa[0].toLowerCase();
str=ssa.join(">")
var ssb = str.split("<");
ssb[2] = ssb[2].toLowerCase();
str=ssb.join("<")
alert (str);
}
</SCRIPT>

Kor
06-01-2005, 09:51 AM
I don't see the reason for you need this. Anyway the page is loaded as it is before the code changes to lowercase, so that you can not avoid any inconvenience that uppercase might occures....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum