<HTML>
<head>
<title>Редактор</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>
<BODY>
<SCRIPT LANGUAGE="javascript">
// Function draw format tool panel
function DrawPanel()
{
//a - self and RichEdit comands
//b - spaces between different tool groups
a=new Array('H1','H2','H3','H4'
,'Bold','Italic','Superscript','Subscript',
'Underline','JustifyLeft','JustifyCenter',
'JustifyRight','JustifyFull',
'InsertUnorderedList','InsertOrderedList',
'Indent','Outdent','CreateLink',
'InsertHorizontalRule','RemoveFormat',
"InsertTable","InsertImage");
b=new Array(0,0,0,1,0,0,0,0,1,0,0,
0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0);
// tool panel writing
for (i=0;i<21;i++)
{document.write("<TD><INPUT type=button style=\"width:22; height:22;background-image: url(images/"+a[i]+".gif)\" OnClick=\"SetStyle ('"+a[i]+"')\" TITLE="+a[i]+"></TD>" );
if (b[i]) document.write('<TD><IMG SRC="images/vline.gif" WIDTH="8"
HEIGHT="20" BORDER=0></TD>');
}
}
//Function draw table panel
function DrawTablePanel()
{
//a - table parameters names
//b - table parameters vaues
//c - sizes of input boxes
a=new Array('TableCol','TableRow','TableBorder','TablePadding',
'TableSpacing','TableWidth');
b=new Array(2,2,1,2,0,"100%");
c=new Array(20,20,20,20,20,40);
for (i=0;i<6;i++)
{
document.write(
'<TD><IMG SRC="images/'+a[i]+'.gif" WIDTH="18" HEIGHT="18" BORDER=0
ALT="'+a[i]+'"></TD>'+
'<TD><INPUT STYLE="font-size:10px;
font-family:Arial; width='+c[i]+'; height=17" TYPE=TEXT VALUE="'+b[i]+'" ID='+a[i]+'></TD>'+
'<TD WIDTH=8> </TD>'
);
}
}
// Function show and hide the tool panel then HTML sourse is viewed
function SetViewHTML()
{
if (document.all['Panel'].style.visibility=="visible")
{frames ["EditFrame"].document.body.innerText= frames ["EditFrame"].document.body.innerHTML;
document.all['Panel'].style.visibility="hidden";
}
else
{frames ["EditFrame"].document.body.innerHTML=
frames ["EditFrame"].document.body.innerText;
document.all['Panel'].style.visibility="visible";
}
}
// Function execute format commandes.
function SetStyle (newStyle)
{
frames ['EditFrame'].focus();
var selection = frames ['EditFrame'].document.selection.createRange();
if ((newStyle=="H1") || (newStyle=="H2") || (newStyle=="H3") || (newStyle=="H4"))
{selection.pasteHTML("<"+newStyle+">"+selection.
text+"</"+newStyle+">")} else
if (newStyle=="InsertTable") {SwapPanel();} else
selection.execCommand (newStyle);
frames ['EditFrame'].focus();
}
// Function swap table panel and format tool panel. Table panel is hidden
function SwapPanel()
{
var iTable=document.all['Panel'].innerHTML; document.all['Panel'].innerHTML=document.all['DivTableInsert'].innerHTML;
document.all['DivTableInsert'].innerHTML=iTable;
}
//Function formed and insert table into edited text
function InsertTable()
{
var rows=document.all['TableRow'].value;
var cols=document.all['TableCol'].value;
var table=frames ['EditFrame'].document.createElement("table");
table.border=document.all['TableBorder'].value;
table.cellPadding=document.all['TablePadding'].value;
table.cellSpacing=document.all['TableSpacing'].value;
table.width=document.all['TableWidth'].value;
for (i=0;i<rows;i++)
{
table.insertRow();
j=0;
for (j=0;j<cols;j++)
{
table.rows(i).insertCell();
}
}
frames ['EditFrame'].document.selection.createRange().pasteHTML(table.outerHTML);
SwapPanel();
}
</SCRIPT>
<small>
<div align=right>
<a href="index.html">Russian</a> |
<a href="eng.htm">English</a> |
<a href="fra.htm">French</a></DIV>
</small>
<!-- --------------------------------------------Tool panel -------------------------------------------- -->
<FORM ACTION="default.asp" METHOD="post">
<TABLE BGCOLOR="#CCCCCC" WIDTH=100%>
<TR>
<TD>
<TABLE CELLPADDING="0" CELLSPACING="0">
<TR>
<TD>
<INPUT ID="ButtonHTML" type=button style="width:22; height:22;background-image: url(images/HTML.gif)" OnClick="SetViewHTML()" TITLE="SourceHTML">
</TD>
<TD><IMG SRC="images/vline.gif" WIDTH="8" HEIGHT="20" BORDER=0></TD>
<TD>
<DIV ID="Panel" STYLE="visibility:visible">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR>
<SCRIPT>DrawPanel();
</SCRIPT>
</TR>
</TABLE>
</DIV>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<!-- -------------------------------------------- The editor frame -------------------------------------------- -->
<IFRAME SRC="about_rus.htm" ID="EditFrame" WIDTH="100%" HEIGHT="320" CONTENTEDITABLE="true"></IFRAME><BR>
<SCRIPT>
var RichEdit = frames ['EditFrame'].document;
RichEdit.designMode = 'On';
//
//
// You can create new content of editor arrea from this script.
//
// RichEdit.open ();
// RichEdit.write ("<h1>Hello Editor!</h1>");
// RichEdit.close ();
//
//
</SCRIPT>
</FORM>
<!-- -------------------------------------------- The hidden table panel -------------------------------------------- -->
<DIV ID="DivTableInsert" WIDTH=0 HEIGHT=0 STYLE="visibility:hidden">
<TABLE CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
</TD>
<SCRIPT>
DrawTablePanel();
</SCRIPT>
<td >
<INPUT TYPE=button style="width:22; height:22;background-image: url(images/OK.gif)" OnClick="InsertTable()" TITLE="InsertTable">
</TD>
<TD>
<INPUT TYPE=button style="width:22; height:22;background-image: url(images/Abort.gif)" OnClick="SwapPanel()" TITLE="Abort">
</TD>
</TABLE>
</DIV>
</BODY>
</HTML>
|