
Contents
Introduction
What is htmlArea?
Is it really free? What's the catch?
What are the browser requirements?
Can I see an example of what it looks like?
Where can I find out more info, download the latest version, and talk to other htmlArea users?
Installation / Setup
How do I add htmlArea to my web page?
I want to change the editor settings, how do I do that?
How can I change what controls are displayed on the toolbar?
How can I change what fonts are in the font list?
How can I change what sizes are in the font size?
How can I change what styles are in the font style (CSS) list?
How can I specify an external stylesheet for my styles?
Frequently Asked Questions
What the project goals for htmlArea?
This editor is pretty neat, so how does it actually work?
You don't happen to have one of these for (Netscape, Mozilla, Opera, Mac IE, etc) do you?
Why doesn't htmlArea output XHTML instead of regular HTML? Can you make it do that?
I'd like to be able to upload images from my hard drive, can you add that feature?
I'd like to <insert idea here>, can you add that feature?
Can I change the toolbar/button colors?
I love htmlArea, is there anything I can do to help the project?
Why do the toolbar buttons take so long to load when I have multiple htmlArea editors on the same page?
Known Bugs & Issues
Undo/Redo doesn't work
Relative paths are converted to absolute paths
HTML header info (eg: <head>, <body>, etc) doesn't get preserved
Some tags (eg: noframes, noscript, etc) doesn't get preserved
htmlArea doesn't work when multiple textareas that have the same name
Why do I get "non secure items" warnings when using htmlarea on a secure (SSL) https:// page?
Introduction
What is htmlArea?
htmlArea is a free WYSIWYG (what you see is what you get) editor replacement for <textarea> fields. By adding a few simple lines of JavaScript to your web page you can replace a regular textarea with a rich text editor that let your users do the following:
- Format text to be bold, italicized, or underlined.
- Change the face, size, style and colour.
- Left, centre, or right-justify paragraphs.
- Make bulleted or numbered lists.
- Indent or un-indent paragraphs.
- Insert a horizontal line.
- Insert hyperlinks and images.
- View the raw HTML source of what they're editing.
- and much more...
Some of the interesting features of htmlArea that set's it apart from other web based WYSIWYG editors are as follows:
- It's lightweight, fast loading and can transform a regular textarea into a rich-text editor with a single line of JavaScript.
- It's 100% backwards compatible with older or non-supported browsers (they get the original textarea field).
- It's free and can be incorporated into any free or commercial program.
- It works with any programming language (ASP, PHP, Perl, Java, etc).
- It's written in simple JavaScript and can be easily viewed, modified or extended.
- It remembers entered content when a user navigates away and then hits "back" in their browser.
- Since it replaces existing textareas it doesn't require a lot of code to add it to your pages (just one line).
- Did we mention it was free? : )
Is it really free? What's the catch?
Yes! It's really free. You can use it, modify it, distribute it with your software, or do just about anything you like with it.
What are the browser requirements?
htmlArea requires Internet Explorer 5.5 or better on Windows to run. This is because it makes use of some advanced features of IE5.5 that aren't available in other browsers yet. It is backwards compatible with other browsers, though. They will get a regular textarea field instead of a WYSIWYG editor.
Can I see an example of what it looks like?
Sure, make sure you're using IE5.5 or better on windows and see below.
Here is a regular <textarea> field.
And here is a <textarea> transformed with htmlArea (with a single line of JavaScript code).
Where can I find out more info, download the latest version, and talk to other htmlArea users?
You can find out more about htmlArea and download the latest version on the htmlArea homepage and you can talk to other htmlArea users and post any comments or suggestions you have in the htmlArea forum.
Installation / Setup
How do I add htmlArea to my web page?
It's easy, first you need to upload the htmlArea files to your website. Just follow these steps:
- Download the latest version from the htmlArea homepage.
- Unzip the files onto your local computer (making sure to maintain the directory structure contained in the zip).
- Create a new folder on your website called /htmlarea/ (make sure it's NOT inside the cgi-bin).
- Transfer all the htmlArea files from your local computer into the /htmlarea/ folder on your website.
- Open the example page /htmlarea/example.html with your browser to make sure everything works.
Once htmlArea is on your website all you need to do is add some JavaScript to any pages that you want to add WYSIWYG editors to. Here's how to do that.
- Open the page you want to add a WYSIWYG editor to. Add the following to the top of the page in the <head></head> of the HTML document.
<script language="Javascript1.2"><!--
_editor_url = "";
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate()
{ return false; }</scr'+'ipt>'); }
If you've installed htmlArea anywhere other than /htmlarea/ then be sure to change _editor_url to point to your htmlarea directory (ending with a forward slash "/").
- For each <textarea> that you want to change, add the following code to the page.
<script language="JavaScript1.2" defer>
editor_generate('fieldname');
</script>Be sure to change "fieldname" to be the name (not id) of the textarea you want to change.
- And you're done, open your page in your browser and see if it worked. If you run into any problems, keep trying and feel free to visit the htmlArea forum.
I want to change the editor settings, how do I do that?
While it's true that all you need is one line of JavaScript to create an htmlArea WYSIWYG editor you can also specify more config settings in the code to control how the editor works and looks. Here's an example of some of the available settings:
<script language="JavaScript1.2" defer>
var config = new Object();
config.width = "90%";
config.height = "200px";
config.bodyStyle = 'background-color: white; font-family: "Verdana";' +
'font-size: x-small;';
config.debug = 0;
editor_generate('fieldname',config);
</script>See below for even more configuration options that can be added. All of these settings will use default values in editor.js if you don't specify them yourself.
| Width |
specifies the width of the editor (in pixels or as a percentage). |
| Height |
specifies the height of the editor (in pixels or as a percentage). |
| bodyStyle |
specifies CSS style of the editor window including color, default font face, and size. Note, the default font information isn't saved, it just controls how text is displayed if no other font formatting has been applied. |
| debug |
if set to 1, displays a debug field with the actual contents of the editor (in raw html) which is updated as your type. |
How can I change what controls are displayed on the toolbar?
You can add a config.toolbar config setting to control exactly what's shown on the toolbar. Here's an example.
config.toolbar = [
['fontname'],
['fontsize'],
['fontstyle'],
['linebreak'],
['bold','italic','underline','separator'],
['strikethrough','subscript','superscript','separator'],
['justifyleft','justifycenter','justifyright','separator'],
['OrderedList','UnOrderedList','Outdent','Indent','separator'],
['forecolor','backcolor','separator'],
['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
['about','help']
];
The square brackets control how the buttons are "grouped" together. You can either erase or comment out (by adding // to the beginning of the line) buttons or button groups you don't want displayed. Most of the buttons do pretty much just what you'd expect, but here's a few odd ones for reference.
| linebreak |
adds a linebreak to the toolbar, all buttons after this are on the next line. |
| separator |
adds a vertical separator between buttons, helps to visually group buttons together |
| customN |
these are custom buttons that can be defined by JavaScript programmers who want to extend htmlArea. |
How can I change what fonts are in the font list?
There is a config.fontnames setting that lets you control this. See below.
config.fontnames = {
"Arial": "arial, helvetica, sans-serif",
"Courier New": "courier new, courier, mono",
"Georgia": "Georgia, Times New Roman, Times, Serif",
"Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
"Times New Roman": "times new roman, times, serif",
"Verdana": "Verdana, Arial, Helvetica, sans-serif",
"impact": "impact",
"WingDings": "WingDings"
};The name on the left is what is displayed to the user. The list of fonts on the right is what is actually put into the font tag in the code.
How can I change what sizes are in the font size?
There is a config.fontsizes setting that lets you control this. See below.
config.fontsizes = {
"1 (8 pt)": "1",
"2 (10 pt)": "2",
"3 (12 pt)": "3",
"4 (14 pt)": "4",
"5 (18 pt)": "5",
"6 (24 pt)": "6",
"7 (36 pt)": "7"
};The value on the right is what the user sees, the value on the left is the actual font size used.
How can I change what styles are in the font style (CSS) list?
As you can probably guess, there's a config.fontstyles setting for this. Now remember, the styles defined here control how the text looks in the editor. These styles ALSO have to be defined on any page where you display content created with the editor. htmlArea will save the class name with the content but nothing else. It's up to you to define the class style in your pages.
config.fontstyles = [{
name: "headline",
className: "headline",
classStyle: "font-family: arial; font-size: 28px;"
},{
name: "red text",
className: "saletext2",
classStyle: ""
}];The "name" is what's displayed to users, "className" is the name of the CSS class to use, and classStyle defines the attributes of the style in the editor. If you leave classStyle blank you have to be sure to also specify an external stylesheet with all the style information (and matching classNames!). See the next question on how to do that.
How can I specify an external stylesheet for my styles?
You can specify a stylesheet to avoid entering the class style data for each class name. You still have to specify which classNames you want to have available though, see the previous question for information on that.
config.stylesheet = "/style.css";
Frequently Asked Questions
What are the project goals for htmlArea?
When we originally started the htmlArea project we had some pretty specific goals in mind for how it would work and what issues were important to us. Those goals still lead the direction of development today and are listed below in order of priority.
- Compatibility
htmlArea has to always be backwards compatible with older and unsupported browsers. This ensures that even if a user with an older and unsupported browser can't use htmlArea, they'll always be able to, at a minimum, enter text in a plain textarea like they would have done before. htmlArea should also be compatible with as many programming languages as possible by being completely DHTML and JavaScript based.
- Ease of Use
htmlArea needs to be easy for developers to integrate into their applications and customize, easy for programmers to extend and modify, and easy for end users to "use". That's why you only have to add a single line of JavaScript for each textarea you want to convert, and why all the code is stored in a single, easy to follow JavaScript file. That's why htmlArea can be used with almost any programming language (ASP, PHP, Perl, Java, etc), and that the toolbar is streamlined, customizable by developers, and follows the conventions of common word processing programs.
- Lightweight
htmlArea needs to be fast loading, allow the user to perform word processing functions at a reasonable speed, and not put a lot of strain on a user's browser. To these ends we've managed to keep the main editor program in a single file of only 40k and we've written the editor in such a way that it has a minimal impact on the resources of the browser it is running in. In addition, where we make use of popup windows to perform additional functions we try to put as much code as possible in the popup window so it doesn't increase the size of the base editor.
This editor is pretty neat, so how does it actually work?
htmlArea is based on the MSHTML Editing Platform in Internet Explorer 5.5+ on windows. Basically, Internet Explorer includes some functionality to make sections of a webpage editable by defining a "contentEditable" attribute or "designMode" property. It also provides some built in commands for performing common web editing operations (bold, italic, center, insert image, etc).
htmlArea builds on the features provided by Internet Explorer and adds its own user definable toolbar, an easy method to include a WYSIWYG editor in a web page (replacing textareas), an easy way to save user changes, as well as a number of custom web editing commands of its own.
How htmlArea actually works is it replaces a textarea with an (user definable) toolbar, an iframe that has the "contentEditable" attribute set to true, and a hidden field with the same name as your original textarea that gets updated automatically when you modify content in the editor.
The user can enter or modify text as well as use keyboard shortcuts and toolbar buttons to perform operations on the content. A lot of the editor commands are built into IE and called via the execCommand method, but htmlArea also includes other custom commands and functions written in JavaScript and stored in the editor.js file or the popup windows (in the /popups/ folder).
You don't happen to have one of these for (Netscape, Mozilla, Opera, Mac IE, etc) do you?
No. None of these other browsers (including IE for Mac) support "contentEditable" or a way to make existing content in the page editable. It might be possible to emulate this in JavaScript, but it would be a lot of work. Other problems include displaying or emulating the flashing | bar cursor you see when editing. The cross-platform Mozilla browser has some bug entries related to adding contentEditable functionality, and perhaps in the future it may be possible to create something for that browser.
Although it's a long shot, you might want to send a friendly letter to Microsoft to encourage them to make the "contentEditable" functionality work on IE for the Macintosh. Once they implement it, we can offer it.
Why doesn't htmlArea output XHTML instead of regular HTML? Can you make it do that?
The HTML output by htmlArea is generated by the built in functionality of Internet Explorer. For that reason, there is no easy way to have it output XHTML. If we were going to do it, the way to do so would be to parse the HTML after it's output by IE and convert it to XHTML. That's something we hope to do at some point.
I'd like to be able to upload images from my hard drive, can you add that feature?
No. We want htmlArea to be compatible with as many programming languages as possible. Because it's written in client side JavaScript, it should work with any programming language. If we start adding language specific features htmlArea won't be as useful to as many people. That said, there's a lot of free "file upload" scripts available, and htmlArea does include a function called editor_insertHTML() for inserting text or HTML tags. If you want to write your own program for doing this it shouldn't be that hard. Alternatively, you might check in the forum to see if someone already has.
I'd like to <insert idea here>, can you add that feature?
Maybe, maybe not. If it's a good feature and it fits in with the goals of our project we'll likely consider it. The best thing to do is post your suggestions to the forum. At the very least we'll try to give you some suggestions and point you in the right direction. At best you might find somebody else has already implemented the feature you were hoping for.
Can I change the toolbar/button colors?
Yes, just search for "buttonface" and "buttonhighlight" in editor.js and change those to whatever colors you like. If you haven't heard of those colors before, it's because they're special windows colors that match whatever color scheme the user has selected for their desktop. For example, if someone has changed their desktop color scheme to "lilac", the WYSIWYG editor toolbar and buttons will match that theme. Try it, it's really neat.
I love htmlArea, is there anything I can do to help the project?
The number one thing you can do to help is also the easiest thing to do; give us a link on your website. The more people who can find out about htmlArea the better it will be.
The next best thing you can do is participate in our forum and post a message or two to help other htmlArea users (or learn something new yourself).
Lastly, any code improvements you want to share would certainly be welcome as well.
Why do the toolbar buttons take so long to load when I have multiple htmlArea editors on the same page?
This is a bug/feature of Internet Explorer. htmlArea dynamically updates the content of your page to replace a textarea with the WYSIWYG editor. In Internet Explorer, when you update the content of a page after it has loaded and insert an image it will load the image from the server EVEN if has the image in it's cache. This means if you have 10 htmlareas on the same page the "bold" toolbar button will be loaded 10 times.
One workaround for this is to move all your editor_generate() scripts to the bottom of the page, combine them into one script tag, and remove the "defer" attribute from that script tag. This will cause them all to run just as the page is finishing loading and the cached images WILL be used. Meaning, the browser will only need to load each image once.
Known Bugs and Issues
Undo/Redo doesn't work
We update a hidden field every time you make a change in the editor so the hidden field will be submitted when you submit the form. The way undo/redo works in Internet Explorer it seems to reset the undo buffer every time you use JavaScript to set the value of a form element or otherwise make changes to the page. Because of this the built in undo/redo functionality of the browser doesn't work. We hope to implement our own undo/redo functionality at a future point.
Relative paths are converted to absolute paths
Internet Explorer has a tendency to convert relative paths into absolute paths. We've seen some implementations of WYSIWYG editors that maintain relative paths "better" than others but certain operations (such as dragging and dropping, etc) still convert relative paths to absolute paths. We hope to find a workaround for this in a future version.
HTML header info (eg: <head>, <body>, etc) doesn't get preserved
This is due to Internet Explorer and the way the editor works. The editor already has a HTML header of its own so inserting another one confuses the browser and the content gets thrown away. The best solution is to have another plain text textarea field for HTML header information.
Some tags (eg: noframes, noscript, etc) doesn't get preserved
This is a result of how Internet Explorer works. It seems to discard certain tags that it doesn't need to display. Because htmlArea reads the content back from the browser it cannot preserve content the browser has "thrown away".
htmlArea doesn't work with multiple textareas that have the same name
If you have two or more textareas with the same name on the same page and you try to convert one or more of them into a WYSIWYG editor htmlArea won't work. This is because htmlArea looks up the textareas by name in the entire page, not just inside a specific form. There's currently no workaround for this. We hope to resolve it in a future release.
Why do I get "non secure items" warnings when using htmlarea on a secure (SSL) https:// page?
This is a bug/feature of Internet Explorer. Even if you get unsecure warnings your form contents should still be submitted securely.
htmlArea uses an <iframe> to contain the editor and because the contents of the iframe isn't being loaded off a secure site, Internet Explorer thinks the iframe is unsecure. The problem is, the iframe doesn't load anything off any site, it's blank, it doesn't even have a src attribute. We just create an empty iframe and then use javascript to update it. We hope to have this fixed in a future release.
Note: There's a clever workaround for this problem posted in the forum here. The only issue with it is that can cause the back button to not work as intended (it goes back in the iframe first).
Change Log
Version 2.03 (Released: December 17, 2002)
- new license - switched to "BSD style" software license. The "About this editor" button is no longer required.
- readme updates - minor updates, spelling, and grammar fixes.
Version 2.02a (Released: December 5, 2002)
- fixed error in readme.html example code under "How do I add htmlArea to my web page?".
Version 2.02 (Released: December 5, 2002)
Bug Fixes (Thanks to everybody in the forum for contributing and reporting bugs!)
- fix nested script tag error (thanks to Phil Revill)
New Features
- added 'replaceNextlines' config option to replace nextlines with spaces on output
- added 'plaintextInput' config option to replace nextlines with <br> tags on input
Version 2.01 (Released: December 3, 2002)
Bug Fixes (Thanks to everybody in the forum for contributing and reporting bugs!)
- fixed "function not found" error for non IE5.5+ browsers (thanks to slowhand)
- popup editor - fixed javascript error caused during launch of popup (thanks to slowhand and Chlorel)
- popup editor - fixed toolbar 'linebreak' error (thanks to fbridge9 and RekiM)
Documentation Updates
- Add two new questions to readme.html
- Why do the toolbar buttons take so long to load when I have multiple htmlArea editors on the same page?
- Why do I get "non secure items" warnings when using htmlarea on a secure (SSL) https:// page?
Version 2.00 (official release) (Released: November 25, 2002)
New Javascript Functions
- editor_getHTML(objname) - return HTML content of editor
- editor_setHTML(objname) - set HTML content of editor
- editor_appendHTML(objname) - add HTML content to editor
New Features
- Popup "fullscreen" editor now has minimize and maximize buttons (switched from ModalDialog to popup window)
Bug Fixes (Thanks to everybody in the forum for contributing and reporting bugs!)
- "Create Table" popup now creates tables with the correct number of cols and rows (thanks to Corey)
- Clicking on images no longer causes error when you have "CSS style pulldown" enabled (thanks to Virrdo)
- Fixed bug that prevented external stylesheets from working properly (thanks to slowhand)
- fixed javascript errors in Mozilla 1.0 (thanks to slowhand)
- moved browser detection code to editor page to prevent javascript errors from older browsers and prevent the editor from being loaded unless it's needed.
- submitting empty htmlarea now submits nothing "" instead of "<p> </p>"
- Popup "fullscreen" editor no longer generates error on "<>" html mode change
Version 2.00 (beta2) (Released: October 16, 2002)
New Docs
- created new readme.html with install instructions, faq, and lots of information
New Features
- added support for stylesheets
- get enlarge/shrink window working
- get context menu working (still disabled by default, needs more code for functionality)
- allow user to change ANY option in internal config from calling page
- added _editor_filterOutput function that's called on form submit
- added insert table button
Bug Fixes / Optimizations
- organized associated files into directories
- fixed bug that caused htmlarea to sometimes not display last entered content when user pressed back in their browser.
- moved about window into a separate file to reduce size of editor
Version 2.00 (beta1) (Released: August 19, 2002)
visual changes
- added mouseover/mouseoff events and style for toolbar ui buttons
- update toolbar to take up less space and be smaller
- display point sizes beside HTML font sizes (eg: 7 (36px)
- change "about this editor" icon to an "i"
- created a help popup (content still needs to be written).
- added version number to about page.
code changes
- added "defer" to script tag to prevent editor from being created until page loads
- simplified header that needs to be added to pages that contain editor
- generated script include tag using _editor_url so users don't have to enter URL twice
- moved CSS for editor toolbar buttons into editor.js
- switched to using object to pass configuration arguments to editor_generate
- general code improvements, optimizations and re-organization
- added hooks for keypress events for future use
new features
- added pulldown for CSS style classnames
- added many many more config options including:
- ability to select which toolbar elements you want displayed
- ability to specify the order of toolbar elements
- ability to specify fonts, sizes, and CSS styles for pulldowns
- ability to set default font and style used in editor window
- debug flag that lets you see the source of the WYSIWYG field at all times
- add more sample code and comments showing how to add custom buttons
bug fixes
- fixed error caused when height/width were manually specified (reported by jpeto, thanks!)
- "about this editor" window now works when in textedit mode
Version 1.05 (Released: August 28, 2002)
- - Added support for textareas with underscores ("_") in their names.
Version 1.04 (Released: August 27, 2002)
- Even more speed improvements (WYSIWYG editor is now much faster on older computers).
- General code improvements and optimizations.
Version 1.03 (Released: August 26, 2002)
Version 1.02 (Released: August 21, 2002)
- added editor_insertHTML() function. Developers can now easily add buttons that insert HTML or surround selected text with HTML.
- removed unneeded debug code and comments to reduce editor.js file size (and load time).
Version 1.01 (Released: August 20, 2002)
- optimized code to improve speed (WYSIWYG editor is now much faster)
- added addition event handlers to update UI on mouse events.
Version 1.00 (Released: August 19, 2002)
| You must Sign In to use this message board. |
|
|
 |
|
 |
Hi all,
I love HtmlArad very well. I has used HtmlArea v3.
But now I found problem on IE 8.
When I try to use table properties function such as setting table cell background color, but there is a javascript error.
I try to find the cause of error.
On IE8, I must select some text at table cell that I want to set cell background color. On the other way, if I don't select some text on that cell, the error is occcur.
I found the problem is come from "getParentElement" function. I'm not sure the problem maybe come from lost "selection" object when I use "popup" windows function.
Please help me, how can I solve this problem ? I try to solve about 2 weeks ago until now. But I remain to can't solve this problem.
Thank you very much.
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
 | thanks  Arash Javadi | 3:55 1 Jun '09 |
|
|
 |
|
 |
As soon as I add <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
The text box no longer works.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
When I write something and press enter to come to the next line.It show me gap between two lines.How I can remove that gap?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi! I can't run htmlArea because if I open example.html I get erros: Element 'p' cannot be nested within element 'textarea'. Help me, please.
Thanks. Lubos
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
First off TEXTAREA works great and Thank you for that. Now since I have converted a blog to use text area for posting, the posts show the HTML instead of the formatted text. Below is the code used to display the post. Where can I cange this to allow the display for HTML formatted text?
<code><% @ LANGUAGE=VBScript%> <%Response.Buffer = True%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>View Postings</title> <style fprolloverstyle>A:hover {color: #008000; font-weight: bold} </style><script language="JavaScript1.2" src="ultimate.js"> </script> </head>
<body text="#000000">
<!--#include file="Reply.asp"-->
<% '*** Query for strings and record current message parameters to a hidden form.
If Request.Querystring.Count = 4 then messageID = Request.Querystring.Item(1) currentForum = Request.Querystring.Item(2) treeLevel = Request.Querystring.Item(3) Response.Write "<form method=post name='viewpost'>" Response.Write "<input type='hidden' name='messageID' Value='" & messageID & "'>" & vbcr Response.Write "<input type='hidden' name='currentForum' Value='" & currentForum & "'>" & vbcr Response.Write "<input type='hidden' name='treeLevel' Value='" & treeLevel & "'>" & vbcr currentForumEn = Server.URLEncode(currentForum) Response.Write "<p align='center'><font face='Verdana' size='3' color='#C7DBDE'><b>You are viewing: " & currentForum & "</b></font></p>" OpenRecords Else: noEntry("noArg") End If
Function RandomNumber() Randomize RandomNumber = Int((899 * Rnd) + 100) End Function
Sub OpenRecords() '*** Get all records for current forum. On error resume next Set dbFile = objFile.GetFile(server.mappath("db\Forums\" & currentForum & ".txt")) If err.number <> 0 then call noEntry("noForum") : Exit Sub Set recordGet=objFile.OpenTextFile(dbFile, 1, False) allRecords = recordGet.Read(dbFile.Size) IF allRecords = "" Or allRecords = VbCrlf Then recordGet.Close: noEntry("EmptyForum") Else recordGet.Close: Call GetRecords(allRecords) End IF End Sub
'*** This is a main function that builds the page.
Function GetRecords(allRecords)
Dim globRecord, X, strRec, recArray, Date, Name, Email, Topic, Comment Dim FirstMessage, LastMessage, Y, post, Selected, root, n, arrayNext, NextThreadID Dim PrevMessage, NextMessage allRecords = Left(allRecords, Len(allRecords) - 2) '*** Split All Records into lines and assign to array.
globRecord = Split(allRecords, vbCrLf) allRecords = ""
'*** The following block filtering a single thread from all records for display. '*** For the tree structure explanation see reply.asp
For I = LBound(globRecord) To UBound(globRecord) If InStr(globRecord(I), messageID) <> 0 Then FoundID = True Selected = globRecord(I) Select Case Left(globRecord(I), 3) Case "001" If I = UBound(globRecord) then Call ShowMessage(Selected, "None", "None") Else If not Left(globRecord(I + 1), 3) = "001" then NextMessage = globRecord(I + 1) Call ShowMessage(Selected, "None", NextMessage) Else: Call ShowMessage(Selected, "None", "None") End If End If For n = -I + 1 To LBound(globRecord) If CInt(Left(globRecord(Abs(n)), 3)) = 1 Then arrayNext = Split(globRecord(Abs(n)), sep) NextThreadID = arrayNext(1) Exit For End If Next Call BuildList(I + 1, globRecord, Selected, Selected) Case Else PrevMessage = globRecord(I - 1) If I = UBound(globRecord) then Call ShowMessage(Selected, PrevMessage, "None") Else If not Left(globRecord(I + 1), 3) = "001" then NextMessage = globRecord(I + 1) Call ShowMessage(Selected, PrevMessage, NextMessage) Else: Call ShowMessage(Selected, PrevMessage, "None") End If End If For J = -I To LBound(globRecord) If CInt(Left(globRecord(Abs(J)), 3)) = 1 Then root = globRecord(Abs(J)) For n = J + 1 To LBound(globRecord) If CInt(Left(globRecord(Abs(n)), 3)) = 1 Then arrayNext = Split(globRecord(Abs(n)), sep) NextThreadID = arrayNext(1) Exit For End If Next Call BuildList(Abs(J) + 1, globRecord, Selected, root) Exit For End If Next End Select Exit For End If Next Erase globRecord If not FoundID then noEntry("noID") :Exit Function
If NextThreadID = "" then NextIcon = "Nextna.jpg" NextURL = "javascript:void(0)" Else: NextIcon = "Next.jpg" NextURL = "viewpost.asp?ID=" & Server.URLEncode(NextThreadID) & "&Forum=" & currentForumEn & "&Level=001&Repl=0" End If
BuildReplySection
End Function
Sub ShowMessage(Message, PrevM, NextM)
Dim arrayM, TopicM, PostedByM, DateM, MessageM, EmailM arrayM = Split(Message, sep) TopicM = arrayM(4) suggTopic = TopicM PostedByM = arrayM(2) DateM = arrayM(1) DateM = Left(DateM, Len(DateM) -3) MessageM = arrayM(5) IconM = arrayM(7) EmailM = arrayM(3) If Not EmailM = "" then postedByM = "<a href='mailto:" & EmailM & "'>" & postedByM & "</a>" If not Lcase(Left(TopicM, 3)) = "re:" then suggTopic = "Re: " & TopicM If PrevM = "None" then PrevMIcon = "Prevna.jpg" PrevMURL = "javascript:void(0)" Else arrayPrevM = Split(PrevM, sep) PrevMIcon = "Prev.jpg" PrevMURL = "viewpost.asp?ID=" & Server.URLEncode(arrayPrevM(1)) & "&Forum=" & currentForumEn & "&Level=" & arrayPrevM(0) & "&Repl=0" End If If NextM = "None" then NextMIcon = "Nextna.jpg" NextMURL = "javascript:void(0)" Else arrayNextM = Split(NextM, sep) NextMIcon = "Next.jpg" NextMURL = "viewpost.asp?ID=" & Server.URLEncode(arrayNextM(1)) & "&Forum=" & currentForumEn & "&Level=" & arrayNextM(0) & "&Repl=0" End If ReplyToM = VbCr & "> " & Replace(MessageM, "<br>", VbCrLf & "> ") ReplyToMessage = arrayM(2) & " wrote:" & VbCr & ReplyToM %> <input type="hidden" name="flag" value="1">
<div align="center"> <center> <table border="2" width="90%" > <tr> <td width="90%" valign="Top" align="center" bordercolor="#000" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE"> <div align="center"> <center> <table border="1" width="100%" cellspacing="0" > <tr> <td width="31%" height="16"><b><font face="Verdana" size="1" >Posted: </font><font face="Verdana" size="1" color="blue" ><%=DateM%></font></b></td> <td width="69%" height="16"><b><font face="Verdana" size="1" > <%=TopicM%></font></b></td> </tr> <tr> <td width="90%" height="600" colspan="3" valign="top" align="left" ><DIV style="overflow: scroll; width: 100%; height: 100%; border-style: inset; border-width: 2"><TT> <font face="Arial" size="2"> <%=MessageM%></font></b></TT></DIV> </td> </tr> </table> </center> </div> </td> </tr> <tr> <td width="90%" valign="Top" align="center" bordercolor="#C7DBDE" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE">
<% End Sub Sub BuildList(n, rec, nohref, root) Dim arrayRec, recType, datePosted, postedBy, Email, Topic, Icon, ThreadID %>
<div align="center"> <center> <table border="0" width="100%" cellspacing="1" bordercolor="#C7DBDE" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE" > <tr> <td width="68%" bordercolor="#C7DBDE" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE" valign="middle" height="10"> <b><font face="Verdana" size="1">Listings:</font></b></td> <td width="14%" bordercolor="#C7DBDE" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE" valign="middle" align="center" height="10"> <b><font face="Verdana" size="1"></font></b></td> <td width="18%" bordercolor="#C7DBDE" bordercolorlight="#C7DBDE" bordercolordark="#C7DBDE" valign="middle" align="center" height="10"> <b><font face="Verdana" size="1">Date Posted:</font></b></td> </tr> <% arrayRec = Split(root, sep) recType = arrayRec(0) datePosted = arrayRec(1) datePosted = Left(datePosted, Len(datePosted) -3) ID = Server.URLEncode(arrayRec(1)) postedBy = arrayRec(2) Email = arrayRec(3) Topic = arrayRec(4) Icon = arrayRec(7) If Not Email = "" then postedBy = "<a href='mailto:" & Email & "'>" & postedBy & "</a>"
If nohref = root then %> <tr> <td width='68%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='left' height='1'> <b><font face="Verdana" size="1" > <span><%=Topic%></span></font></b></td> <td width='14%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=postedBy%></font></b></td> <td width='18%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=datePosted%></font></b></td> </tr> <% Else %> <tr> <td width='68%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='left' height='1' style="font-family: Verdana; font-size: 8pt; font-weight: bold"> <img border='0' src='Images/<%=Icon%>'> <a href='viewpost.asp?ID=<%=ID%>&Forum=<%=currentForumEn%>&Level=<%=recType%>&Repl=0'><%=Topic%></a></td> <td width='14%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=postedBy%></font></b></td> <td width='18%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=datePosted%></font></b></td> </tr> <% End If
For I = n To UBound(rec) ThreadID = CInt(Left(rec(I), 3)) If ThreadID > 1 Then arrayRec = Split(rec(I), sep) recType = arrayRec(0) datePosted = arrayRec(1) datePosted = Left(datePosted, Len(datePosted) - 3) ID = Server.URLEncode(arrayRec(1)) postedBy = arrayRec(2) Email = arrayRec(3) Topic = arrayRec(4) par = FormatTopic(CInt(recType)) Icon = arrayRec(7) If Not Email = "" then postedBy = "<a href='mailto:" & Email & "'>" & postedBy & "</a>" If rec(I) = nohref then %> <tr> <td width='68%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='left' height='1'><%=par%> <img border='0' src='Images/<%=Icon%>'><b><font face="Verdana" size="1" color="#FF6666"> <span ><%=Topic%></span></font></b></td> <td width='14%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=postedBy%></font></b></td> <td width='18%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=datePosted%></font></b></td> </tr> <% Else %> <tr> <td width='68%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='left' height='1' style="font-family: Verdana; font-size: 8pt; font-weight: bold"><%=par%> <img border='0' src='Images/<%=Icon%>'> <a href='viewpost.asp?ID=<%=ID%>&Forum=<%=currentForumEn%>&Level=<%=recType%>&Repl=0'><%=Topic%></a></td> <td width='14%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=postedBy%></font></b></td> <td width='18%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='middle' align='center' height='1'> <b><font face="Verdana" size="1"><%=datePosted%></font></b></td> </tr> <% End If ElseIf ThreadID = 1 then arrayPrev = Split(rec(I), sep) PrevThreadID = arrayPrev(1) Exit For Else: Exit For End If Next If PrevThreadID = "" then PrevIcon = "Prevna.jpg" PrevURL = "javascript:void(0)" Else: PrevIcon = "Prev.jpg" PrevURL = "viewpost.asp?ID=" & Server.URLEncode(PrevThreadID) & "&Forum=" & currentForumEn & "&Level=001&Repl=0" End If
End Sub
Sub BuildReplySection() %>
<tr> <th width='80%' bordercolor='#C7DBDE' bordercolorlight='#C7DBDE' bordercolordark='#C7DBDE' valign='top' align='right' height='10' colspan="3"> <a href="<%=PrevURL%>"><img border="0" src="Images/<%=PrevIcon%>"></a> <b><font face="Verdana" size="1">Next Job</font></b> <a href="<%=NextURL%>"><img border="0" src="Images/<%=NextIcon%>"></a> </th> </tr> </table> </center> </div> </td> </tr> </table> </center> </div>
<div align="center">
<div> <a href="default.asp?Forum=<%=Server.URLEncode(currentForum)%>">Back to ALL listings</a> </div> </div> </td> </tr> <tr> </tr> </table> </center> </div>
<%
End Sub
Function FormatTopic(level) For I = 1 to level - 1 tString = " " & tString Next FormatTopic = tString End Function
Sub noEntry(action) Dim msgEmpty Select Case action Case "noArg" message = "This page must be accessed from 'View Forums' page. Redirecting in 3 seconds......" Case "noForum" message = "Requested forum does not exist or was removed. Redirecting in 3 seconds......" Case "EmptyForum" message = "Requested forum does not contain any messages. Redirecting in 3 seconds......" Case "noID" message = "Requested message ID does not exists. Redirecting in 3 seconds......" End Select
Response.Write "<p align='center'><b><font face='Bangle' size='3' color='#C7DBDE'>" & message & "</font></b></p>" & vbcr Response.Write "<p align='center'><b><font face='Bangle' size='3' color='#C7DBDE'>Click <a href='default.asp' style='color: #33CC33'>Here</a> if your browser does not redirect.</font></b></p>" & vbcr Response.Write "<meta http-equiv=refresh content='3; url=default.asp'>"
End Sub %>
</form>
<p align="center"><b><font face="Arial" size="2" >©2008 Airsysco.com - All Rights Reserved</font></b></p> </body>
</code>
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
I use html textarea with WYSIWYG editor. when i include runat="server" in html textarea, The editor is not working and is missing. What seems to be the problem?
|
| Sign In·View Thread·PermaLink | 1.75/5 |
|
|
|
 |
|
 |
I have a special requirement for text editor. I need to restrict the content of text area. Means
User can enter only 60 characters per line and maximum line should be 15. If user enters more than 60 characters in a line or more then 15 lines then alert should open and it will not allow user to do that.
Please suggest me how to achieve this requirement.
Thanks
Pankaj Mishra
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
Hi i appreciate ur effort and is good also. but one thing i shud tell is its not cross-browser handled. too many obsolete methods like document.all instead of document.getElementById. and attachEvent,insertAdjacentHTML etc.
Cheers Bino www.codepal.co.nr
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
WYSIWYG editor doesn't work in mozilla firefox browser.
Also, when i tried to change the <INPUT ID=txtFileName type=text önFocus="select()"> into <INPUT ID=txtFileName type=file önFocus="select()"> on insert_image.html it doesn't work in internet explorer 7 and firefox. The picture is not coming out.
McBernard
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
ur editor will not work in Mozilla since u r returning it as false.
www.codepal.co.nr
Cheers Bino www.codepal.co.nr
|
| Sign In·View Thread·PermaLink | 1.33/5 |
|
|
|
 |
|
 |
How do I get this to work when using masterpages, I added the header script to the masterpage but it still only enters the text into the textarea, it doesn't show the editor
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Try this.......
<textarea name="MyTextArea" id="MyTextArea" style="width:700px; height:200px" runat="server">
</textarea><br> <script language="javascript1.2"> editor_generate('ctl00_ContentPlaceHolder1_MyTextArea'); </script>
Lovely Manuel Santhisoft Technologies
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i want to have my typing area transparent, which is not write in color, and 0px of border, how can i do it? i have tried days and days.
|
| Sign In·View Thread·PermaLink | 1.63/5 |
|
|
|
 |
|
 |
hello Hello everybody! I want to create a new editor by javascript and html.It has only emotion icons.But I don't know how to determine the position of the mouse pointer in textarea. Anybody help me!? Thanks alot!
phuochung
|
| Sign In·View Thread·PermaLink | 1.14/5 |
|
|
|
 |
|
 |
hello Hello everybody! I want to create a new editor by javascript and html.It has only emotion icons.But I don't know how to determine the position of the mouse pointer in textarea. Anybody help me!? Thanks alot!
phuochung
|
| Sign In·View Thread·PermaLink | 1.40/5 |
|
|
|
 |
|
 |
I want to change the Background color of the entire textarea (and the body of the html) instead of just the text-background. Is there a way to do it???
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
The page in which I want to implement this editor inherits from Master Page and the editor is giving me the javascript error "toolbar[..]" undefined . Please suggest how can i implement this editor with a page having master Page. thnx.
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
Try this way.........
<textarea name="MyTextArea" id="MyTextArea" style="width:700px; height:200px" runat="server">
</textarea><br> <script language="javascript1.2"> editor_generate('ctl00_ContentPlaceHolder1_MyTextArea'); </script>
Lovely Manuel Santhisoft Technologies
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I am already using the prototype.js script for many things in my project and can't seem to get this and your script to get along together. any ideas?
|
| Sign In·View Thread·PermaLink | 1.50/5 |
|
|
|
 |
|
 |
In my sample web application i am using simple ajax control like update panel. The question is as soon as the page get loaded all i see is empty textarea with no formating components. but i comments my ajax stuff like simple updatepanel then the textarea loaded perfectly ok. i am sure that my updatepanel is workign perfectly alright. it's just if i use updatepanel then i don't get the textarea to work with <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
|
| Sign In·View Thread·PermaLink | 1.67/5 |
|
|
|
 |
|
 |
I liked this control and also wondering if your textarea WYSIWYG editor does convert the string into rtf formate lets say i did bold,underline a string and i want to store and then pass this string so i can display somewhere else later in my webapplication. Is there anyother way that i am not aware.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
I've installed the scripts on an asp page. The editing controls appear as expected. When I select some text in the textarea then click any of the editing buttons I get the following error message:
Line: 3 Char: 1 Error: object required: 'this'.
What have I done wrong not setup correctly?
|
| Sign In·View Thread·PermaLink | 3.00/5 |
|
|
|
 |
|
 |
Hi i am using the TExtAREA3.o. i need help.
how ot get the value of the textarea?
wht is the property to be taken to get the value id ar name of text area.
m using submit button. and i need to save the text area content which enterred to be stored i ndb.
Please help asap.
Regards, Valli
|
| Sign In·View Thread·PermaLink | 2.67/5 |
|
|
|
 |
|
|