editor.jsp
来自「一个用java编写的功能强大的OA系统」· JSP 代码 · 共 469 行 · 第 1/2 页
JSP
469 行
function hideColorTableDiv(d){
if(d || (obj_colorpicker && !document.inColorTable)){
document.getElementById('ColorTableDiv').style.display='none';
obj_colorpicker = '';
}
}
document.onmousedown = hideColorTableDiv;
function op_undo(){
var f=document.frames[0];
if(f.teller > 0){
var obj = f.document.getElementById('nr' + f.teller);
redo_array.unshift( [obj.outerHTML,1] );
obj.removeNode(true);
f.teller--;
return true;
}
return false;
}
function op_redo(){
var f=document.frames[0];
if( redo_array.length > 0 ){
if(redo_array[0][1]==0){ //橡皮
f.document.body.insertAdjacentHTML('beforeend',redo_array[0][0]);
}
else if(redo_array[0][1]==1){ //删除
f.teller++;
f.document.body.insertAdjacentHTML('beforeend',redo_array[0][0]);
}
else if(redo_array[0][1]==2){ //属性更改
f.document.getElementById(redo_array[0][2]).outerHTML = redo_array[0][0];
}
else if(redo_array[0][1]==3){ //置前置后
var arg = redo_array[0][0].split(',');
var obj = f.document.getElementById('nr'+arg[0]);
var obj2 = f.document.getElementById('nr'+arg[1]);
obj.id='nrTEMPID';
obj2.id = 'nr' + arg[0];
obj2.style.zIndex = arg[0];
obj.id = 'nr' + arg[1];
obj.style.zIndex = arg[1];
}
redo_array.shift();
return true;
}else{
redo_array = new Array();
alert('已无记录.');
return false;
}
}
function op_clear(){
while(op_undo()){}
}
function startAcessKey(){
document.keydowned=1;
}
function doAccessKey(ev){
if( document.keydowned && ev.srcElement.tagName.toLowerCase()!='textarea' ){
if((ev.ctrlKey && ev.keyCode!=17)||ev.keyCode==13){
var inputs = document.getElementsByTagName('input');
for(i=0;i<inputs.length;i++){
if(ev.keyCode==13 && inputs[i].type=='submit') inputs[i].click();
else if(inputs[i].accessKey==String.fromCharCode(ev.keyCode)) inputs[i].click();
}
}
}
document.keydowned = 0;
}
document.onkeydown = startAcessKey;
document.onkeyup = function(){doAccessKey(event);}
function help(){
var out = '1. 纯粹手写板由[纯粹空间] http://www.softpure.com 提供.\n\n';
out += '2. 在图形编辑界面,画好图形后按"生成并返回",即可直接发帖.\n\n';
out += '3. 您可以点击"编辑代码",将图形代码粘贴到代码框中生成图形,并可继续编辑.\n\n';
out += '4. 选定发帖内容框中的相应代码,再点"纯粹手写板"按钮,可还原该代码的图形.';
alert(out);
}
</SCRIPT>
<FORM onSubmit="return false;">
<table width="100%" border="0" cellspacing="3" cellpadding="0" id="editTable">
<tr>
<td>
<IFRAME src="paper.htm" width="<%=w%>" height="<%=h%>" name="codetext" frameborder="0" style="border:1px dashed #CCCCCC; "></IFRAME><br /></td>
</tr>
<tr>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" nowrap><table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td><input type="hidden" name="toolshape" id="toolshape" value="" />
<script language="javascript">
var toolshape_array = new Array();
toolshape_array['shape'] = '~|铅笔工具 - 画任意曲线';
toolshape_array['pen'] = '─|直线工具';
toolshape_array['oval'] = '○|椭圆工具';
toolshape_array['rect'] = '□|矩形工具';
toolshape_array['roundrect'] = '¤|圆角矩形工具';
toolshape_array['br1'] = '';
toolshape_array['zindexdown'] = '后|置后一层 - 点击将选定元件置后一层';
toolshape_array['zindexup'] = '前|置前一层 - 点击将选定元件置前一层';
toolshape_array['move'] = '移|移动工具 - 拖动动选定元件';
toolshape_array['formatbrush'] = '刷|格式刷工具 - 将当前格式设置应用到选定元件';
toolshape_array['formatget'] = '取|拾取工具 - 将选定元件格式应用到当前设置';
toolshape_array['br2'] = '';
toolshape_array['edit'] = '改|更改工具 - 更改选定元件';
toolshape_array['eraser'] = '擦|橡皮工具 - 点击擦除选定元件';
var toolshape_html = '';
for(key in toolshape_array){
if(toolshape_array[key]==''){
toolshape_html += '<br />';
continue;
}
var toolshape_txt = toolshape_array[key].split('|');
toolshape_html += "<label class='btn tool' id='button_"+key+"' style='width:20px;height:20px;text-align:center;' onclick='selectToolShape(\""+key+"\")' title=\""+toolshape_txt[1]+"\">"+toolshape_txt[0]+"</label>";
}
document.write(toolshape_html);
function selectToolShape(val){
var toolshapeObj = document.getElementById('toolshape') ;
if(toolshapeObj.value) document.getElementById( 'button_' + toolshapeObj.value ).className = 'btn tool' ;
document.getElementById( 'button_' + val ).className = 'btn_on' ;
toolshapeObj.value = val ;
}
</script>
</td>
</tr>
<tr>
<td>笔触:
<input type="input" size="3" name="strokeweight" id="strokeweight" class="input" style="text-align:center;" value="2" onBlur="if(!this.value.match(/^\d+$/)||this.value==0||this.value>20){alert('请输入小于20的正整数.');this.value=2;}" />
<input name="button" type="button" class="btn" title="减小笔触" onMouseDown="eval(this.script); this.timeout=setInterval(this.script,400);" onMouseUp="clearInterval(this.timeout)" value="↓" script="var obj=document.getElementById('strokeweight');if(obj.value>1) obj.value=parseInt(obj.value)-1;"><input name="button" type="button" class="btn" title="增大笔触" onMouseDown="eval(this.script); this.timeout=setInterval(this.script,400);" onMouseUp="clearInterval(this.timeout)" value="↑" script="var obj=document.getElementById('strokeweight');if(obj.value<20) obj.value=parseInt(obj.value)+1;"> </td>
</tr>
</table></td>
<td width="150" valign="top">
<div style="position:absolute; display:none;" id="ColorTableDiv">
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td>
<table id="ColorTable" border="0" cellspacing="0" cellpadding="0" onMouseOver="document.inColorTable=1;" onmouseout="document.inColorTable=0;"></table> </td>
<td width="2"></td>
<td width="10" class="input" id="colorShow"> </td>
</tr>
</table>
</div>
<script language="javascript">
function CreateColorTable()
{
var oTable = document.getElementById('ColorTable') ;
var aColors = ['00','33','66','99','cc','ff'] ;
function AppendColorRow( rangeA, rangeB ){
for ( var i = rangeA ; i < rangeA + 3 ; i++ ){
var oRow = oTable.insertRow(-1);
for ( var j = rangeB ; j < rangeB + 3 ; j++ ) {
for ( var n = 0 ; n < 6 ; n++ ){
AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
}
}
}
}
function AppendColorCell( targetRow, color){
var oCell = targetRow.insertCell(-1) ;
oCell.className = 'colorvalue' ;
oCell.bgColor = color ;
if(!color)oCell.innerHTML = '<div title="透明">×</div>';
}
AppendColorRow( 0, 0 ) ;
AppendColorRow( 3, 0 ) ;
AppendColorRow( 0, 3 ) ;
AppendColorRow( 3, 3 ) ;
var oRow = oTable.insertRow(-1) ;
for ( var n = 0 ; n < 6 ; n++ ){
AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
}
for ( var i = 0 ; i < 12 ; i++ ){
AppendColorCell( oRow, '');
}
}
CreateColorTable();
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<center>
<table width="100" border="0" cellspacing="3" cellpadding="0">
<tr>
<td width="29%" height="25" align="center">描边</td>
<td width="71%" align="center" id="forecolor_cel" style="CURSOR:pointer;BACKGROUND-COLOR:#000000;COLOR: #FF0033; BORDER:1px inset;" onClick="start_pickcolor('forecolor')"> </td>
</tr>
<tr>
<td width="29%" height="25" align="center">填充</td>
<td align="center" id="backcolor_cel" style="CURSOR: pointer;BACKGROUND-COLOR:#ffffff;COLOR: #FF0033; BORDER:1px inset;" onClick="start_pickcolor('backcolor')">透明</td>
</tr>
</table>
</center></td>
</tr>
<tr>
<td height=6></td>
</tr>
<tr>
<td align="center">
<input type=button class="btn" onClick="op_clear()" value="清空"><input type="button" class="btn" onClick="help()" value="帮助"><br>
<input type="button" class="btn" accesskey="Z" onClick="op_undo()" value="删除" title="删除最后产生的元件;快捷键:Ctrl+Z"><input type="button" class="btn" accesskey="Y" onClick="op_redo()" value="恢复" title="恢复最后的元件或属性;快捷键:Ctrl+Y">
<input type="hidden" value="" name="backcolorvalue">
<input type="hidden" value="#000000" name="forecolorvalue"> </td>
</tr>
</table> </td>
<td width="110" align="center">
<input type="button" class="btn" style="width:80px;" onClick="var code=make_code(); document.getElementById('value_codetext').value = (code?'[whitepad]'+code+'[/whitepad]':'');codeTableShow(1);" value="编辑代码">
<br>
<input name="submit" id="submit" type="submit" class="btn" style="width:80px;height:50px;margin-top:4px;font-weight:bold;" onClick="returnVal();" value="生成并返回"></td>
</tr>
</table></td>
</tr>
</table>
</FORM>
<span style="color:#666666;">纯粹手写板 由 <a href="http://www.softpure.com/" target="_blank">纯粹空间</a> 提供</span>
<SCRIPT language="JavaScript">
document.forms[0].reset();
</SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?