Click here to Skip to main content
6,594,932 members and growing! (16,382 online)
Email Password   helpLost your password?
Web Development » Client side scripting » General     Intermediate

Code Project Article Writer Helper

By Jason Henderson

Some HTML and JavaScript that helps you write and preview CP articles.
Javascript.NET 1.0, Win2K, WinXP, Dev
Posted:10 Nov 2002
Updated:9 Aug 2003
Views:131,154
Bookmarked:74 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
63 votes for this article.
Popularity: 8.54 Rating: 4.75 out of 5
1 vote, 2.4%
1
1 vote, 2.4%
2
2 votes, 4.9%
3
5 votes, 12.2%
4
32 votes, 78.0%
5

Sample Image - articlehelp.jpg

Introduction

Here is a utility you may find useful when writing articles for the Code Project[^] offline. It should cut down on your HTML formatting time plus it will give you a preview all on the same page. As far as I know, it only works in Internet Explorer.

How to Use It

There are buttons on the left of the textarea that mimic the HTML insertion on the CP forums pages. I added p (<p></p>), br (<br>), space ( ), sup (<sup></sup>), sub (<sub></sub>), H2 (<H2></H2>) and img (<img src=...>) since articles may need them.

The textarea is where you type the article, of course.

The buttons below the textarea are for normal editing of the textarea except for the preview button. Preview will show you a close approximation of how the page will look in a <div> below the buttons.

Here is some code for the preview:

function ShowPreview()
{
    // replace div innerHTML content

    previewarea.innerHTML = '<table border=1 width=100 
        height=100% cellpadding=0 cellspacing=0><tr>
        <td valign=top align=left>' + Form1.inputarea.value 
        + '</td></tr></table>';
}
...
<button onclick="ShowPreview()" type="button">Preview</button>
...
<div name="previewarea" id="previewarea" style="WIDTH: 100%;
    HEIGHT: 300px; BACKGROUND-COLOR: #ffffff"></div>

Conclusion

This article was created in the Article Helper, so as you can see, it seems to work OK. I hope you find it helpful.

Most of this javascript code was shamelessly stolen from the Code Project's Reply To a Message page. I hope Chris doesn't mind...

Revision History

Version 1.1
  • Updates the preview area on the OnKeyUp event of the textarea, and also after the OnClick of all relevant buttons. (Thanks for the suggestion Zek3vil!)
Version 1.2
  • Added ol, ul, and li buttons for making tables of contents.
  • Added buttons to open an HTML file, and Save the Helper text to an HTML file.
Version 1.3
  • XHTML compliant tags. (Suggested by Thomas Freudenberg)
  • Added a quot button for entering quotation marks. (" ")
  • Added a table button, plus row and column input areas to make HTML tables.
         
         
  • Added drop down list of less commonly used tags including:
    blockquote, center, cite, div, dl, dt, dd, em, H1, H3, H4, H5, H6, hr, iframe, hr, marquee, tt
    Choose a tag and click the use button to paste it into the page.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Jason Henderson


Member
I live in the middle of nowhere in Illinois, United States, and I am married and have three kids (all boys).
Occupation: Software Developer (Senior)
Location: United States United States

Other popular Client side scripting articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 50 (Total in Forum: 50) (Refresh)FirstPrevNext
Generalnot Firefox PinmemberMichael Sync0:23 6 Nov '06  
GeneralArticle Helper Earthquakes PinmemberDave Rapp14:37 13 Dec '04  
GeneralRe: Article Helper Earthquakes PinmemberJason Henderson17:47 13 Dec '04  
GeneralMissing Functionality PinmemberBassam Abdul-Baki4:26 29 Jan '04  
GeneralRe: Missing Functionality PinmemberJeffrey Walton21:19 16 Dec '06  
GeneralQuick question... PinmemberBoozeBomb5:42 4 Aug '03  
GeneralRe: Quick question... PinmemberJason Henderson6:12 4 Aug '03  
GeneralRe: Quick question... PinmemberBoozeBomb8:19 4 Aug '03  
GeneralXHTML PinmemberThomas Freudenberg23:23 9 Mar '03  
GeneralRe: XHTML PinmemberJason Henderson6:04 4 Aug '03  
GeneralRe: XHTML PinmemberThomas Freudenberg6:20 4 Aug '03  
GeneralRe: XHTML PinmemberGilesHinton22:11 11 May '07  
GeneralVersion 1.2 is not available for DL Pinmemberkbuchan5:44 5 Mar '03  
GeneralRe: Version 1.2 is not available for DL PinmemberJason Henderson5:50 5 Mar '03  
GeneralRe: Version 1.2 is not available for DL Pinmemberkbuchan3:35 6 Mar '03  
GeneralRe: Version 1.2 is not available for DL PinmemberJason Henderson4:00 6 Mar '03  
GeneralRe: Version 1.2 is not available for DL Pinmemberkbuchan4:33 6 Mar '03  
GeneralRe: Version 1.2 is not available for DL PinmemberJason Henderson11:50 11 Mar '03  
GeneralMe again! PinmemberMarc Clifton14:52 27 Feb '03  
GeneralRe: Me again! PinmemberJason Henderson15:43 27 Feb '03  
GeneralRe: Me again! PinmemberMarc Clifton1:26 28 Feb '03  
GeneralRe: Me again! PinadminChris Maunder8:28 28 Feb '03  
GeneralRe: Me again! PinmemberJason Henderson18:12 1 Mar '03  
GeneralRe: Me again! PinmemberJason Henderson18:14 1 Mar '03  
GeneralAdded source code coloring PinmemberJonathan de Halleux2:33 14 Feb '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 9 Aug 2003
Editor: Chris Maunder
Copyright 2002 by Jason Henderson
Everything else Copyright © CodeProject, 1999-2009
Web19 | Advertise on the Code Project