![]() |
Web Development »
Client side scripting »
General
Intermediate
License: The Code Project Open License (CPOL)
Fully JavaScript Enabled EditorBy Saleth PrakashFully JavaScript enabled editor which also contains some server coding |
C#, VB, Javascript, HTML, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||

Well, this is my sixth article. Here, I have tried a fully JavaScript enabled editor. Here I have updated it with more features.
In the article, I am giving sample code. The full code is available in the zip file.
This is the updated version. I have included features like inserting images, flashes, templates, media files, special characters and saving templates. I have also included features of inserting HTML controls like button, text box, checkbox, radiobutton, submit button, reset button, select type listbox and dropdownlist, etc. You can also insert date and time in any format.
function setColor(colorTo,x,y)
{
editFrame.focus();
editFrame.document.execCommand(colorTo,true, colorArray[x][y]);
popDivId.style.display = "none";
}
function setFont(fontName)
{
editFrame.focus();
editFrame.document.execCommand("FontName", false, fontName);
popDivId.style.display = "none";
}
function setFontSize(fontSize)
{
editFrame.focus();
editFrame.document.execCommand("FontSize", false, fontSize);
popDivId.style.display = "none";
}
function doAction(action)
{
editFrame.focus();
if(action == "ClearAll")
{
editFrame.document.execCommand("SelectAll",true);
action = "Delete";
}
editFrame.document.execCommand(action,true);
}
function showDialog(link,w, h)//380, 125
{
if(link == "li")
link = "InsertLinks.htm";
else if(link == "sc")
link = "SpecialChars.htm";
var returnedTxt= showModalDialog(link,"", "dialogWidth:"+
w +"px; dialogHeight:"+ h +"px; status:no; center:yes");
editFrame.focus();
if(returnedTxt)
{
var theRange = editFrame.document.selection.createRange();
theRange.pasteHTML(returnedTxt);
}
}
var cWnd;
function showInsertPopup(opt, w, h) // w=350, h=340
{
var srcfile = "imgWindow.aspx";
if(opt == "im")
srcfile = "imgWindow.aspx";
else if(opt == "fl")
srcfile = "flashWindow.aspx";
else if(opt == "me")
srcfile = "mediaWindow.aspx";
else if(opt == "tm")
srcfile = "templateWindow.aspx";
else if(opt == "st")
srcfile = "saveWindow.aspx";
else if(opt == "tb")
srcfile = "InsertTable.htm";
var left = (window.screen.width - parseInt(w))/2;
var top = (window.screen.height - parseInt(h))/2;
if(cWnd)
cWnd.close();
cWnd = window.open(srcfile,"", "width="+ w +",height="+
h +",location=no, status=no, top="+ top +", left="+ left);
}
function doHtmlAction(atype)
{
editFrame.focus();
var selectedRegion = editFrame.document.selection.createRange();
if(atype == "lower")
selectedRegion.text = selectedRegion.text.toLowerCase();
else if(atype == "upper")
selectedRegion.text = selectedRegion.text.toUpperCase();
}
Thank you. I expect feedback from you, and you expect more from me.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 27 Nov 2008 Editor: Sean Ewington |
Copyright 2008 by Saleth Prakash Everything else Copyright © CodeProject, 1999-2009 Web12 | Advertise on the Code Project |