www.webdeveloper.com
Results 1 to 8 of 8

Thread: who claims to be a genious???

  1. #1
    Join Date
    Oct 2005
    Posts
    34

    who claims to be a genious???

    hi, i have some html stored in a database which is sent directly from a html editor on a page, when displaying the html i want to display it without any of the styling which is inside the html tags. is there a way of ignoring all of the html tags in a certain block, whilst still showing what is inbetween them. eg:

    <span style="font-size:7em">TEXT</span>

    i want to ignore the tags and display the word 'TEXT' as the default size, the html will be put in by somebody else, theres no way of overruling every possible thing they can do, that was only a simple example. im using cute editor, the user can make tables, put images in, anything really, i just want to disable all tags


    ????

  2. #2
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    You'd need to write a function with a serverside language that pulls the info from the database, parses it, and removes all tags, then outputs the page without them. No small feat. What serverside languages does your host support and what database is being used?

  3. #3
    Join Date
    Oct 2005
    Posts
    34
    genious, put your fore-finger on your forehead and call ureself a genious!
    thanks

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Server-side is best, but with JavaScript
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>rip HTML</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
    onload=function() {
    var str=document.getElementById('user').innerHTML;
    var newStr=str.replace(/(<[^<>]*>)/gi, "");
    document.getElementById('user').innerHTML=newStr;
    }
    </script>
    
    </head>
    <body>
    <p>User's comments</p>
    <div id="user" style="border:1px solid red;">
    	<span style="font-size:7em">TEXT</span>
    	<p>bla bla</p>
    	<table border="1" cellpadding="0" cellspacing="0" summary="">
    		<tr><td>xxxx</td></tr>
    	</table>
    </div>
    </body>
    </html>

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,537
    If you can use PHP for server-side scripting, it has a handy built-in function called htmlentities() that will do this for you.

    PS: I'm genius enough to know that there is no "o" in "genius".
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    May 2005
    Posts
    105
    Quote Originally Posted by NogDog
    PS: I'm genius enough to know that there is no "o" in "genius".
    lol

  7. #7
    Join Date
    Oct 2005
    Posts
    34
    Quote Originally Posted by NogDog
    PS: I'm genius enough to know that there is no "o" in "genius".

    just testing!

  8. #8
    Join Date
    Oct 2005
    Posts
    34
    im using asp.net and an sql server database, can i put anything into the stored procedure to cut out anything inside <> tags which are returned from the select statement??

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles