Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Convert html tags to Lower Case

    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.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    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>

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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....
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •