SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member here4u247's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sound easy but..........

    Greetings folks,

    guys i'm making this CMS project. i want the user to be able to post article. when posting he/she will have the choise to make his text as bold using checkbox, inputbox and submit and insert the HTML value into the textarea. i done this part.

    what gives me headech is, i want a sample (of how the text gonna be).

    i.e: when the Bold checkbox is checked the sample text in document is changed to bold and the same goes for italic, underline, color etc....

    now, i made the function that displays the Bold text sample but the problem with it is, it erase everything and displays Sample bold text alone and i don't want that, i want to display it without erasing anything, how can i do that?

    Abdi

  2. #2
    SitePoint Addict streetlife's Avatar
    Join Date
    Mar 2004
    Location
    D-Town
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hiya, I think I can help but I'm not really understanding exactly how you're trying to do this so if you can post some sample code or even better link to a sample page then I'm sure we can get this figured.

  3. #3
    SitePoint Member here4u247's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by streetlife
    Hiya, I think I can help but I'm not really understanding exactly how you're trying to do this so if you can post some sample code or even better link to a sample page then I'm sure we can get this figured.
    thanks streetlife for your help, http://www.qandala.com/modules/news/submit.php, seeing from the source they use Javascript, but its hard to understand since they use E-xoops(CMS)

    thanks again streetlife

  4. #4
    SitePoint Member here4u247's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by streetlife
    Hiya, I think I can help but I'm not really understanding exactly how you're trying to do this so if you can post some sample code or even better link to a sample page then I'm sure we can get this figured.
    Here is the code i made but as i said it does print the bold sample text but erase everything else in the page!

    <html>

    <head>
    <script language="JavaScript">
    function bold()
    {
    if(document.form1.b.value!=null)
    {
    document.write("<b>Sample</b>");
    }

    }
    </script>
    </head>

    <body>
    <form name="form1">
    B <input type="checkbox" name="b" value="b" onClick="bold()">
    </form>

    </body>

    </html>

  5. #5
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do this:
    Code:
    function bold() 
    { 
    if(document.form1.b.value!=null) 
    { 
    document.write("<b>Sample</b>"); 
    } 
    
    }
    ...say goodbye to your document (web page!). Use a pop-up 'preview' window (or an iframe) instead.
    ::: certified wild guess :::


Bookmarks

Posting Permissions

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