| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1821 人关注过本帖
标题:UBB问题
只看楼主 加入收藏
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
 问题点数:0 回复次数:11 
UBB问题
我用的是别人的UBB代码.函数都已经写好了,写入数据库也不用转换,已经自已转换好了.


有个问题就是,我按回车的时候,是<P>而不是<BR>
这要怎么改......
搜索更多相关主题的帖子: UBB 数据库 函数 回车 代码 
2005-12-23 12:14
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 

function Editor(content){
document.write('<iframe name="wrEditor" id="wrEditor" width="500" height="250" src="about:blank"></iframe>');
oEditor = document.wrEditor;
var strHtml = '<html><style>body{font-size:14px;line-height: 20px; margin:2px;}\ntd, a{color:#0000FF; font-size:14px;}</style><body>'+content+'</body></html>';
oEditor.document.open();
oEditor.document.write(strHtml);
oEditor.document.close();

oEditor.document.designMode="On";
oEditor.focus();
}
应该是这个函数实现的确


中国人的财富网:http://www..cn/
2005-12-23 12:17
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
P也是一样呀,设置一下CSS样式就好了

p {margin:0px;}

天津网站建设 http://www./
2005-12-23 12:46
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 

为什么按回车会是P,而不是Chr(13)
以前没用UBB的时候按回车是没有那么大的空行的!!!
老大,在哪里可以看出来!!

[此贴子已经被作者于2005-12-23 13:13:52编辑过]


中国人的财富网:http://www..cn/
2005-12-23 13:13
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
以下是引用griefforyou在2005-12-23 12:46:00的发言:
P也是一样呀,设置一下CSS样式就好了

p {margin:0px;}


天津网站建设 http://www./
2005-12-23 13:35
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 
以下是引用caiyakang在2005-12-23 13:13:00的发言:

为什么按回车会是P,而不是Chr(13)
以前没用UBB的时候按回车是没有那么大的空行的!!!
老大,在哪里可以看出来!!


最主要是我用换行来分页............................................................................
我按回车,是P不是BR,就分页不了...


中国人的财富网:http://www..cn/
2005-12-23 13:39
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
以下是引用caiyakang在2005-12-23 13:39:00的发言:

最主要是我用换行来分页............................................................................
我按回车,是P不是BR,就分页不了...

不能用Replace来替换?

2005-12-23 14:27
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 
以下是引用yms123在2005-12-23 14:27:00的发言:

不能用Replace来替换?

我按回车的时候,那个UBB程序自动把回车换成《P》

yms123你有没有现成的UBB代码,
可以直接用的,不用那么麻烦的。
不要太多的那种,

先谢谢了!!


中国人的财富网:http://www..cn/
2005-12-23 14:36
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

说实话我也懒得写的说-_-汗,不过我倒是自己找到过UBB的代码。不是用JavaScript的,用ASP的代码来做的UBB类。

2005-12-23 14:46
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 

刚才试了一下,SHIFT+ENTER才转成《BR》
这个功能在哪实现的:
源码如下:

var bodyID,htmlableID;

var Eu88_wangkuan_yToolbars = new Array();

var Eu88_wangkuan_YInitialized = false;

var Eu88_wangkuan_filterScript = false;

var Eu88_wangkuan_charset="UTF-8";

function document.onreadystatechange()
{
if (Eu88_wangkuan_YInitialized) return;
Eu88_wangkuan_YInitialized = true;

var i, s, curr;

for (i=0; i<document.body.all.length; i++)
{
curr=document.body.all[i];
if (curr.className == "yToolbar")
{
Eu88_wangkuan_InitTB(curr);
Eu88_wangkuan_yToolbars[Eu88_wangkuan_yToolbars.length] = curr;
}
}
}

function Eu88_wangkuan_InitBtn(btn)
{
btn.onmouseover = Eu88_wangkuan_BtnMouseOver;
btn.onmouseout = Eu88_wangkuan_BtnMouseOut;
btn.onmousedown = Eu88_wangkuan_BtnMouseDown;
btn.onmouseup = Eu88_wangkuan_BtnMouseUp;
btn.ondragstart = Eu88_wangkuan_YCancelEvent;
btn.onselectstart = Eu88_wangkuan_YCancelEvent;
btn.onselect = Eu88_wangkuan_YCancelEvent;
btn.YUSERONCLICK = btn.onclick;
btn.onclick = Eu88_wangkuan_YCancelEvent;
btn.YINITIALIZED = true;
return true;
}

function Eu88_wangkuan_InitTB(y)
{
y.TBWidth = 0;
if (!Eu88_wangkuan_PopulateTB(y)) return false;
y.style.posWidth = y.TBWidth;
return true;
}


function Eu88_wangkuan_YCancelEvent()
{
event.returnValue=false;
event.cancelBubble=true;
return false;
}

function Eu88_wangkuan_BtnMouseOver()
{
if (event.srcElement.tagName != "IMG") return false;
var image = event.srcElement;
var element = image.parentElement;

if (image.className == "Eu88_wangkuan_Ico") element.className = "Eu88_wangkuan_BtnMouseOverUp";
else if (image.className == "Eu88_wangkuan_IcoDown") element.className = "Eu88_wangkuan_BtnMouseOverDown";

event.cancelBubble = true;
}

function Eu88_wangkuan_BtnMouseOut()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}

var image = event.srcElement;
var element = image.parentElement;
yRaisedElement = null;

element.className = "Eu88_wangkuan_Btn";
image.className = "Eu88_wangkuan_Ico";

event.cancelBubble = true;
}

function Eu88_wangkuan_BtnMouseDown()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
event.returnValue=false;
return false;
}

var image = event.srcElement;
var element = image.parentElement;

element.className = "Eu88_wangkuan_BtnMouseOverDown";
image.className = "Eu88_wangkuan_IcoDown";

event.cancelBubble = true;
event.returnValue=false;
return false;
}

function Eu88_wangkuan_BtnMouseUp()
{
if (event.srcElement.tagName != "IMG") {
event.cancelBubble = true;
return false;
}

var image = event.srcElement;
var element = image.parentElement;

if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");

element.className = "Eu88_wangkuan_BtnMouseOverUp";
image.className = "Eu88_wangkuan_Ico";

event.cancelBubble = true;
return false;
}

function Eu88_wangkuan_PopulateTB(y)
{
var i, elements, element;

elements = y.children;
for (i=0; i<elements.length; i++) {
element = elements[i];
if (element.tagName== "SCRIPT" || element.tagName == "!") continue;

switch (element.className) {
case "Eu88_wangkuan_Btn":
if (element.YINITIALIZED == null) {
if (! Eu88_wangkuan_InitBtn(element))
return false;
}

element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;

case "Eu88_wkGen":
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;

//default:
// return false;
}
}

y.TBWidth += 1;
return true;
}

function Eu88_wangkuan_DebugObject(obj)
{
var msg = "";
for (var i in TB) {
ans=prompt(i+"="+TB[i]+"\n");
if (! ans) break;
}
}


function Eu88_wangkuan_validateMode()
{
if (!Eu88_wangkuan_bTextMode) return true;
alert("请取消“查看HTML源代码”选项再使用系统编辑功能或者提交!");
Eu88_wangkuan_Composition.focus();
return false;
}

function Eu88_wangkuan_format1(what,opt)
{
if (opt=="removeFormat")
{
what=opt;
opt=null;
}
Eu88_wangkuan_Composition.focus();
if (opt==null)
{
Eu88_wangkuan_Composition.document.execCommand(what);
}else{
Eu88_wangkuan_Composition.document.execCommand(what,"",opt);
}
Eu88_wangkuan_pureText = false;
Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_format(what,opt)
{
if (!Eu88_wangkuan_validateMode()) return;

Eu88_wangkuan_format1(what,opt);
}

function Eu88_wangkuan_setMode()
{
Eu88_wangkuan_bTextMode=!Eu88_wangkuan_bTextMode;
Eu88_wangkuan_setTab();
var cont;
if (Eu88_wangkuan_bTextMode) {
document.all.Eu88_wangkuan_Toolbars.style.display='none';
Eu88_wangkuan_cleanHtml();
cont=Eu88_wangkuan_Composition.document.body.innerHTML;
cont=Eu88_wangkuan_correctUrl(cont);
if (Eu88_wangkuan_filterScript)
cont=Eu88_wangkuan_FilterScript(cont);
Eu88_wangkuan_Composition.document.body.innerText=cont;
} else {
document.all.Eu88_wangkuan_Toolbars.style.display='';
cont=Eu88_wangkuan_Composition.document.body.innerText;
cont=Eu88_wangkuan_correctUrl(cont);
if (Eu88_wangkuan_filterScript)
cont=Eu88_wangkuan_FilterScript(cont);
Eu88_wangkuan_Composition.document.body.innerHTML=cont;
}
Eu88_wangkuan_setStyle();
Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_setStyle()
{
bs = Eu88_wangkuan_Composition.document.body.runtimeStyle;
//根据mode设置iframe样式表
if (Eu88_wangkuan_bTextMode) {
bs.fontFamily="Arial";
bs.fontSize="10pt";
}else{
bs.fontFamily="Arial";
bs.fontSize="10.5pt";
}
bs.scrollbar3dLightColor= '#D4D0C8';
bs.scrollbarArrowColor= '#000000';
bs.scrollbarBaseColor= '#D4D0C8';
bs.scrollbarDarkShadowColor= '#D4D0C8';
bs.scrollbarFaceColor= '#D4D0C8';
bs.scrollbarHighlightColor= '#808080';
bs.scrollbarShadowColor= '#808080';
bs.scrollbarTrackColor= '#D4D0C8';
bs.border='0';
}

function Eu88_wangkuan_setTab()
{
//html和design按钮的样式更改
var mhtml=document.all.Eu88_wangkuan_TabHtml;
var mdesign=document.all.Eu88_wangkuan_TabDesign;
if (Eu88_wangkuan_bTextMode)
{
mhtml.className="Eu88_wangkuan_TabOn";
mdesign.className="Eu88_wangkuan_TabOff";
}else{
mhtml.className="Eu88_wangkuan_TabOff";
mdesign.className="Eu88_wangkuan_TabOn";
}
}

function Eu88_wangkuan_getEl(sTag,start)
{
while ((start!=null) && (start.tagName!=sTag)) start = start.parentElement;
return start;
}

function Eu88_wangkuan_UserDialog(what)
{
if (!Eu88_wangkuan_validateMode()) return;
Eu88_wangkuan_Composition.focus();
Eu88_wangkuan_Composition.document.execCommand(what, true);

//去掉添加图片时的src="file://
if(what=="InsertImage")
{
Eu88_wangkuan_Composition.document.body.innerHTML=(Eu88_wangkuan_Composition.document.body.innerHTML).replace("src=\"
file://","src=\"");
}

Eu88_wangkuan_pureText = false;
Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_foreColor()
{
if (!Eu88_wangkuan_validateMode()) return;
var arr = showModalDialog("Eu88EditBox/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
if (arr != null) Eu88_wangkuan_format('forecolor', arr);
else Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_backColor()
{
if (!Eu88_wangkuan_validateMode()) return;
var arr = showModalDialog("Eu88EditBox/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
if (arr != null) Eu88_wangkuan_format('backcolor', arr);
else Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_fortable()
{
if (!Eu88_wangkuan_validateMode()) return;
var arr = showModalDialog("Eu88EditBox/table.html", "", "dialogWidth:14.5em; dialogHeight:16.5em; status:0; help:0");

if (arr != null)
{
var ss;
ss=arr.split("*")
row=ss[0];
if (row=="") row=1;
col=ss[1];
if (col=="") col=1;
tbwidth=ss[2];
if (tbwidth=="") tbwidth=500;
tbborder=ss[3];
if (tbborder=="") tbborder=1;
celpadding=ss[4];
if (celpadding=="") celpadding=2;
bdcolor=ss[5];
if (bdcolor=="") bdcolor="#CCCCCC";
bgcolor=ss[6];
if (bgcolor=="") bgcolor="#FFFFFF";
tbalign=ss[7];
if (tbalign=="") tbalign="center";
var string;
string="<table border="+ tbborder +" cellspacing=0 width="+tbwidth+" cellpadding="+ celpadding +" align="+tbalign+" bgcolor='"+ bgcolor +"' bordercolor="+ bdcolor +" style='border-collapse:collapse'>";
for(i=1;i<=row;i++){
string=string+"<tr>";
for(j=1;j<=col;j++){
string=string+"<td>&nbsp;</td>";
}
string=string+"</tr>";
}
string=string+"</table>";
content=Eu88_wangkuan_Composition.document.body.innerHTML;
content=content+string;
Eu88_wangkuan_Composition.document.body.innerHTML=content;
}
else
Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_forswf()
{
var arr = showModalDialog("Eu88EditBox/swf.htm", "", "dialogWidth:15em; dialogHeight:13em; status:0; help:0");

if (arr != null){
var ss;
ss=arr.split("*")
path=ss[0];
row=ss[1];
col=ss[2];
var string;
string="<div align='center'><div style='width:640;text-align:left'><a href="+path+">[全屏查看]</a></div><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width="+row+" height="+col+"><param name=movie value="+path+"><param name=quality value=high><embed src="+path+" pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width="+row+" height="+col+"></embed></object>"
content=Eu88_wangkuan_Composition.document.body.innerHTML;
content=content+string;
Eu88_wangkuan_Composition.document.body.innerHTML=content;
}
else Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_forwmv()
{
var arr = showModalDialog("Eu88EditBox/wmv.htm", "", "dialogWidth:15.5em; dialogHeight:14em; status:0; help:0");

if (arr != null){
var ss;
ss=arr.split("*")
path=ss[0];
width=ss[1];
height=ss[2];
var string;
//string="<object align=center classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 hspace=5 vspace=5 width="+ width +" height="+ height +"><param name=Filename value="+ path +"><param name=ShowStatusBar value=1><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src="+ path +" width="+ width +" height="+ height +"></embed></object>";
string="<embed src='"+ path+"' width="+ width +" height="+ height +" autostart=true loop=false ></embed>";
content=Eu88_wangkuan_Composition.document.body.innerHTML;
content=content+string;
Eu88_wangkuan_Composition.document.body.innerHTML=content;
}
else Eu88_wangkuan_Composition.focus();
}


function Eu88_wangkuan_forrm()
{
var arr = showModalDialog("Eu88EditBox/rm.htm", "", "dialogWidth:15.5em; dialogHeight:14em; status:0; help:0");

if (arr != null)
{
var ss;
ss=arr.split("*")
path=ss[0];
row=ss[1];
col=ss[2];
var string;
string="<object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height="+col+"><param name='CONTROLS' value='ImageWindow'><param name='CONSOLE' value='Clip1'><param name='AUTOSTART' value='-1'><param name=src value="+path+"></object><br><object classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width="+row+" height=60><param name='CONTROLS' value='ControlPanel,StatusBar'><param name='CONSOLE' value='Clip1'></object>";
content=Eu88_wangkuan_Composition.document.body.innerHTML;
content=content+string;
Eu88_wangkuan_Composition.document.body.innerHTML=content;
}
else Eu88_wangkuan_Composition.focus();
}

function Eu88_wangkuan_InsertRow()
{
editor = Eu88_wangkuan_Composition;
objReference=Eu88_wangkuan_GetRangeReference(editor);
objReference=Eu88_wangkuan_CheckTag(objReference,'/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch(objReference.tagName)
{
case 'TABLE' :
var newTable=objReference.cloneNode(true);
var newRow= newTable.insertRow();

for(x=0; x<newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
objReference.outerHTML=newTable.outerHTML;
break;
case 'TBODY' :
var newTable=objReference.cloneNode(true);
var newRow = newTable.insertRow();
for(x=0; x<newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
objReference.outerHTML=newTable.outerHTML;
break;
case 'TR' :
var rowIndex = objReference.rowIndex;
var parentTable=objReference.parentElement.parentElement;
var newTable=parentTable.cloneNode(true);
var newRow = newTable.insertRow(rowIndex+1);
for(x=0; x< newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
}
parentTable.outerHTML=newTable.outerHTML;
break;
case 'TD' :
var parentRow=objReference.parentElement;
var rowIndex = parentRow.rowIndex;
var cellIndex=objReference.cellIndex;
var parentTable=objReference.parentElement.parentElement.parentElement;
var newTable=parentTable.cloneNode(true);
var newRow = newTable.insertRow(rowIndex+1);
for(x=0; x< newTable.rows[0].cells.length; x++)
{
var newCell = newRow.insertCell();
if (x==cellIndex)newCell.id='ura';
}
parentTable.outerHTML=newTable.outerHTML;
var r = editor.document.body.createTextRange();
var item=editor.document.getElementById('ura');
item.id='';
r.moveToElementText(item);
r.moveStart('character',r.text.length);
r.select();
break;
default :
return;
}
}

function Eu88_wangkuan_DeleteRow()
{
editor=Eu88_wangkuan_Composition;
objReference=Eu88_wangkuan_GetRangeReference(editor);
objReference=Eu88_wangkuan_CheckTag(objReference,'/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch(objReference.tagName)
{
case 'TR' :var rowIndex = objReference.rowIndex;//Get rowIndex
var parentTable=objReference.parentElement.parentElement;
parentTable.deleteRow(rowIndex);
break;
case 'TD' :var cellIndex=objReference.cellIndex;
var parentRow=objReference.parentElement;//Get Parent Row
var rowIndex = parentRow.rowIndex;//Get rowIndex
var parentTable=objReference.parentElement.parentElement.parentElement;
parentTable.deleteRow(rowIndex);
if (rowIndex>=parentTable.rows.length)
{
rowIndex=parentTable.rows.length-1;
}
if (rowIndex>=0)
{
var r = editor.document.body.createTextRange();
r.moveToElementText(parentTable.rows[rowIndex].cells[cellIndex]);
r.moveStart('character',r.text.length);
r.select();
}
else
{
parentTable.removeNode(true);
}
break;
default :return;
}
}


function Eu88_wangkuan_InsertColumn()
{
editor = Eu88_wangkuan_Composition;
objReference= Eu88_wangkuan_GetRangeReference(editor);
objReference=Eu88_wangkuan_CheckTag(objReference,'/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch(objReference.tagName)
{
case 'TABLE' :// IF a table is selected, it adds a new column on the right hand side of the table.
var newTable=objReference.cloneNode(true);
for(x=0; x<newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
newCell.focus();
objReference.outerHTML=newTable.outerHTML;
break;
case 'TBODY' :// IF a table is selected, it adds a new column on the right hand side of the table.
var newTable=objReference.cloneNode(true);
for(x=0; x<newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
objReference.outerHTML=newTable.outerHTML;
break;
case 'TR' :// IF a table is selected, it adds a new column on the right hand side of the table.
objReference=objReference.parentElement.parentElement;
var newTable=objReference.cloneNode(true);
for(x=0; x<newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell();
}
objReference.outerHTML=newTable.outerHTML;
break;
case 'TD' :// IF the cursor is in a cell, or a cell is selected, it adds a new column to the right of that cell.
var cellIndex = objReference.cellIndex;//Get cellIndex
var rowIndex=objReference.parentElement.rowIndex;
var parentTable=objReference.parentElement.parentElement.parentElement;
var newTable=parentTable.cloneNode(true);
for(x=0; x<newTable.rows.length; x++)
{
var newCell = newTable.rows[x].insertCell(cellIndex+1);
if (x==rowIndex)newCell.id='ura';
}
parentTable.outerHTML=newTable.outerHTML;
var r = editor.document.body.createTextRange();
var item=editor.document.getElementById('ura');
item.id='';
r.moveToElementText(item);
r.moveStart('character',r.text.length);
r.select();
break;
default :
return;
}
}

function Eu88_wangkuan_DeleteColumn()
{
editor = Eu88_wangkuan_Composition;
objReference=Eu88_wangkuan_GetRangeReference(editor);
objReference=Eu88_wangkuan_CheckTag(objReference,'/^(TABLE)|^(TR)|^(TD)|^(TBODY)/');
switch(objReference.tagName)
{

case 'TD' :var rowIndex=objReference.parentElement.rowIndex;
var cellIndex = objReference.cellIndex;//Get cellIndex
var parentTable=objReference.parentElement.parentElement.parentElement;
var newTable=parentTable.cloneNode(true);
if (newTable.rows[0].cells.length==1)
{
parentTable.removeNode(true);
return;
}
for(x=0; x<newTable.rows.length; x++)
{
if (newTable.rows[x].cells[cellIndex]=='[object]')
{
newTable.rows[x].deleteCell(cellIndex);
}
}
if (cellIndex>=newTable.rows[0].cells.length)
{
cellIndex=newTable.rows[0].cells.length-1;
}
if (cellIndex>=0) newTable.rows[rowIndex].cells[cellIndex].id='ura';
parentTable.outerHTML=newTable.outerHTML;
if (cellIndex>=0){
var r = editor.document.body.createTextRange();
var item=editor.document.getElementById('ura');
item.id='';
r.moveToElementText(item);
r.moveStart('character',r.text.length);
r.select();
}
break;
default :return;
}
}


function Eu88_wangkuan_GetRangeReference(editor)
{
editor.focus();
var objReference = null;
var RangeType = editor.document.selection.type;
var selectedRange = editor.document.selection.createRange();

switch(RangeType)
{
case 'Control' :
if (selectedRange.length > 0 )
{
objReference = selectedRange.item(0);
}
break;

case 'None' :
objReference = selectedRange.parentElement();
break;

case 'Text' :
objReference = selectedRange.parentElement();
break;
}
return objReference
}

function Eu88_wangkuan_CheckTag(item,tagName)
{
if (item.tagName.search(tagName)!=-1)
{
return item;
}
if (item.tagName=='BODY')
{
return false;
}
item=item.parentElement;
return Eu88_wangkuan_CheckTag(item,tagName);
}

function Eu88_wangkuan_code()
{
Eu88_wangkuan_specialtype("<div class=quote style='cursor:hand'; title='Click to run the code' onclick=\"preWin=window.open('','','');preWin.document.open();preWin.document.write(this.innerText);preWin.document.close();\">","</div>");
}

function Eu88_wangkuan_replace()
{
var arr = showModalDialog("Eu88EditBox/replace.html", "", "dialogWidth:16.5em; dialogHeight:13em; status:0; help:0");

if (arr != null){
var ss;
ss=arr.split("*")
a=ss[0];
b=ss[1];
i=ss[2];
con=Eu88_wangkuan_Composition.document.body.innerHTML;
if (i==1)
{
con=Eu88_wangkuan_rCode(con,a,b,true);
}else{
con=Eu88_wangkuan_rCode(con,a,b);
}
Eu88_wangkuan_Composition.document.body.innerHTML=con;
}
else Eu88_wangkuan_Composition.focus();
}


function Eu88_wangkuan_CleanCode() {
editor=Eu88_wangkuan_Composition;
editor.focus();
// 0bject based cleaning
var body = editor.document.body;
for (var index = 0; index < body.all.length; index++) {
tag = body.all[index];
//if (tag.Attribute["className"].indexOf("mso") > -1)
tag.removeAttribute("className","",0);
tag.removeAttribute("style","",0);
}

// Regex based cleaning
var html = editor.document.body.innerHTML;
html = html.replace(/<o:p>&nbsp;<\/o:p>/gi, "");
html = html.replace(/o:/gi, "");
//html = html.replace(/<st1:[^>]*>/gi, "");

// Final clean up of empty tags
html = html.replace(/<font[^>]*>\s*<\/font>/gi, "");
html = html.replace(/<span>\s*<\/span>/gi, "");

editor.document.body.innerHTML = html;
}


function Eu88_wangkuan_FilterScript(content)
{
content = Eu88_wangkuan_rCode(content, 'javascript:', 'javascript :');
//var RegExp = /<script[^>]*>(.|\n)*<\/script>/ig;
//content = content.replace(RegExp, "<!-- Script Filtered -->");
var RegExp = /<script[^>]*>/ig;
content = content.replace(RegExp, "<!-- Script Filtered/n");
RegExp = /<\/script>/ig;
content = content.replace(RegExp, "/n-->");
return content;
}

function Eu88_wangkuan_cleanHtml()
{
var fonts = Eu88_wangkuan_Composition.document.body.all.tags("FONT");
var curr;
for (var i = fonts.length - 1; i >= 0; i--) {
curr = fonts[i];
if (curr.style.backgroundColor == "#ffffff") curr.outerHTML = curr.innerHTML;
}
}

function Eu88_wangkuan_getPureHtml()
{
var str = "";
//var paras = Eu88_wangkuan_Composition.document.body.all.tags("P");
//if (paras.length > 0){
// for (var i=paras.length-1; i >= 0; i--) str= paras[i].innerHTML + "\n" + str;
//} else {
str = Eu88_wangkuan_Composition.document.body.innerHTML;
//}
str=Eu88_wangkuan_correctUrl(str);
return str;
}


function Eu88_wangkuan_correctUrl(cont)
{
var url=location.href.substring(0,location.href.lastIndexOf("/")+1);
cont=Eu88_wangkuan_rCode(cont,location.href+"#","#");
cont=Eu88_wangkuan_rCode(cont,url,"");
return cont;
}

var Eu88_wangkuan_bLoad=false
var Eu88_wangkuan_pureText=true
var Eu88_wangkuan_bTextMode=false

Eu88_wangkuan_public_description=new Eu88_wangkuan_Editor

function Eu88_wangkuan_Editor()
{
this.put_HtmlMode=Eu88_wangkuan_setMode;
this.put_value=Eu88_wangkuan_putText;
this.get_value=Eu88_wangkuan_getText;
}

function Eu88_wangkuan_getText()
{
if (Eu88_wangkuan_bTextMode)
return Eu88_wangkuan_Composition.document.body.innerText;
else
{
Eu88_wangkuan_cleanHtml();
return Eu88_wangkuan_Composition.document.body.innerHTML;
}
}

function Eu88_wangkuan_putText(v)
{
if (Eu88_wangkuan_bTextMode)
Eu88_wangkuan_Composition.document.body.innerText = v;
else
Eu88_wangkuan_Composition.document.body.innerHTML = v;
}

function Eu88_wangkuan_InitDocument(hiddenid, charset)
{
if (charset!=null)
Eu88_wangkuan_charset=charset;
var Eu88_wangkuan_bodyTag="<html><head><style type=text/css>.quote{margin:5px 20px;border:1px solid #CCCCCC;padding:5px; background:#F3F3F3 }\nbody{boder:0px}</style></head><BODY bgcolor=\"#FFFFFF\" >";
var editor=Eu88_wangkuan_Composition;
var h=document.getElementById(hiddenid);
editor.document.designMode="On"
editor.document.open();
editor.document.write(Eu88_wangkuan_bodyTag);
if (h.value!="")
{
editor.document.write(h.value);
}
editor.document.write("</html>");
editor.document.close();
editor.document.body.contentEditable = "True";
editor.document.charset=Eu88_wangkuan_charset;

Eu88_wangkuan_bLoad=true;
Eu88_wangkuan_setStyle();
//eval("Eu88_wangkuan_Composition.document.body.innerHTML+=(self.opener."+ htmlableID +".checked)?(self.opener."+bodyID+".value):(Eu88_wangkuan_ubb2html(self.opener."+ bodyID +".value))");
}


function Eu88_wangkuan_doSelectClick(str, el) {
var Index = el.selectedIndex;
if (Index != 0){
el.selectedIndex = 0;
Eu88_wangkuan_format(str,el.options[Index].value);
}
}

var Eu88_wangkuan_bIsIE5 = (navigator.userAgent.indexOf("IE 5") > -1) || (navigator.userAgent.indexOf("IE 6") > -1);
var Eu88_wangkuan_edit; //selectRang
var Eu88_wangkuan_RangeType;
var Eu88_wangkuan_selection;

//应用html
function Eu88_wangkuan_specialtype(Mark1, Mark2){
var strHTML;
if (Eu88_wangkuan_bIsIE5) Eu88_wangkuan_selectRange();
if (Eu88_wangkuan_RangeType == "Text"){
if (Mark2==null)
{
strHTML = "<" + Mark1 + ">" + Eu88_wangkuan_edit.htmlText + "</" + Mark1 + ">";
}else{
strHTML = Mark1 + Eu88_wangkuan_edit.htmlText + Mark2;
}
Eu88_wangkuan_edit.pasteHTML(strHTML);
Eu88_wangkuan_Composition.focus();
Eu88_wangkuan_edit.select();
}
}

//选择内容替换文本
function Eu88_wangkuan_InsertSymbol(str1)
{
Eu88_wangkuan_Composition.focus();
if (Eu88_wangkuan_bIsIE5) Eu88_wangkuan_selectRange();
Eu88_wangkuan_edit.pasteHTML(str1);
}


function Eu88_wangkuan_selectRange(){
Eu88_wangkuan_selection = Eu88_wangkuan_Composition.document.selection;
Eu88_wangkuan_edit = Eu88_wangkuan_Composition.document.selection.createRange();
Eu88_wangkuan_RangeType = Eu88_wangkuan_Composition.document.selection.type;
}

function Eu88_wangkuan_rCode(s,a,b,i){
//s原字串,a要换掉pattern,b换成字串,i是否区分大小写
a = a.replace("?","\\?");
if (i==null)
{
var r = new RegExp(a,"gi");
}else if (i) {
var r = new RegExp(a,"g");
}
else{
var r = new RegExp(a,"gi");
}
return s.replace(r,b);
}


//提交数据到opener,已无用
/*
function Eu88_wangkuan_handin()
{
if (!Eu88_wangkuan_validateMode()) return;
var strHTMLbegin;
var strHTMLend;
strHTMLbegin = "";
strHTMLend = "";
// eval("self.opener."+bodyID+".value=strHTMLbegin + Eu88_wangkuan_getPureHtml(Eu88_wangkuan_Composition.document.body.innerHTML) + strHTMLend;self.opener."+htmlableID+".checked=true;");
self.close();
}
*/

function Eu88_wangkuan_View()
{
if (Eu88_wangkuan_bTextMode) {
cont=Eu88_wangkuan_Composition.document.body.innerText;
} else {
cont=Eu88_wangkuan_Composition.document.body.innerHTML;
}
cont=Eu88_wangkuan_correctUrl(cont);
bodyTag="<html><head><style type=text/css>.quote{margin:5px 20px;border:1px solid #CCCCCC;padding:5px; background:#F3F3F3 }\nbody{boder:0px; font-family:Arial; font-size:10.5pt}</style></head><BODY bgcolor=\"#FFFFFF\" >";
if (Eu88_wangkuan_filterScript)
cont=Eu88_wangkuan_FilterScript(cont);
//cont=Eu88_wangkuan_rCode(cont,"
\\[dvnews_ad]","<img src='Eu88EditBox/images/pic_ad.jpg' vspace=10 hspace=10 align=left border=1 title='Advertising'>");
//cont=Eu88_wangkuan_rCode(cont,"

\\[dvnews_page]","<br><br><hr
size=2 width=95% align=left>&nbsp; <font color=red face='Tahoma,Arail' size=2><b>Next Page ...</b></font><br><hr size=2 width=95% align=left>");
preWin=window.open('preview','','left=0,top=0,width=550,height=400,resizable=1,scrollbars=1, status=1, toolbar=1, menubar=0');
preWin.document.open();
preWin.document.write(bodyTag);
preWin.document.write(cont);
preWin.document.close();
preWin.document.title="Preview";
preWin.document.charset=Eu88_wangkuan_charset;
}


// 修改编辑栏高度
function Eu88_wangkuan_Size(num)
{
var obj=document.all.Eu88_wangkuan_Container;
if (parseInt(obj.height)+num>=300) {
obj.height = parseInt(obj.height) + num;
}
if (num>0)
{
obj.width="100%";
}
}

/*
function Eu88_wangkuan_ubbcode(){
if (!Eu88_wangkuan_validateMode()) return;
cont=Eu88_wangkuan_getPureHtml(Eu88_wangkuan_Composition.document.body.innerHTML);
var aryCode0 = new Array("<strong>","","</strong>","","<p","[p","</p>","[/p]","<a href=","[url=","</a>","[/url]");
var aryCode1 = new Array("<em>","","</em>","","<u>","","</u>","","<ul>","

    ","</ul>","
","<ol>","
    ","</ol>","
");
var aryCode2 = new Array("<li>","[*]","</li>","","<font color=","[color=","<font face=","[font=","<font size=","[size=");
var aryCode9 = new Array(">","]","<","[","</","[/");
var aryCode = aryCode0.concat(aryCode1).concat(aryCode2).concat(aryCode9);

for (var i=0;i<aryCode.length;i+=2){
cont=Eu88_wangkuan_rCode(cont,aryCode,aryCode[i+1]);
}
// eval("self.opener."+bodyID+".value+=cont;");
self.close();
}

function Eu88_wangkuan_ubb2html(str){
if (str=="")
return str;
var aryCode0 = new Array("<br>","\n","<strong>","
","\\","","\\[/p]","\\","</strong>","\\","<p","\\[p","</p>","\\[/p]","<a href=","","\\[/url'>\\[url=","</a>","\\[/url]");
var aryCode1 = new Array("<em>","
","\\
","","\\","","\\","

","
    ","\\
      ","
","\\[/list'>\\","</em>","\\","<u>","\\","</u>","\\","<ul>","\\
    ","</ul>","\\
","<ol>","\\
    ","</ol>","\\[/list]");
    var aryCode = aryCode0.concat(aryCode1);

    for (var i=0;i<aryCode.length;i+=2){
    str=Eu88_wangkuan_rCode(str,aryCode[i+1],aryCode[i]);
    }
    return str;
    }
    */

    // 拷贝数据到hidden
    function Eu88_wangkuan_CopyData(hiddenid)
    {
    d = Eu88_wangkuan_Composition.document;
    if (Eu88_wangkuan_bTextMode)
    {
    cont=d.body.innerText;
    }else{
    cont=d.body.innerHTML;
    }
    cont=Eu88_wangkuan_correctUrl(cont);
    if (Eu88_wangkuan_filterScript)
    cont=Eu88_wangkuan_FilterScript(cont);
    document.getElementById(hiddenid).value = cont;
    if (document.getElementById(hiddenid).value == '<P>&nbsp;</P>')
    {
    document.getElementById(hiddenid).value = '';
    }
    }

    function Eu88_wangkuan_insert(cons)
    {
    var Eu88_wangkuan_Composition;
    Eu88_wangkuan_Composition.document.body.innerHTML=cons;
    }
    function getver()
    {
    window.open("
    http://www.wangkuan.com","","");
    }

    function Eu88_wangkuan_help()
    {
    showModalDialog("Eu88EditBox/help.html", "", "dialogWidth:13.5em; dialogHeight:12.5em; status:0; help:0");
    }

    [此贴子已经被作者于2005-12-23 14:47:36编辑过]


中国人的财富网:http://www..cn/
2005-12-23 14:46
快速回复:UBB问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037720 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved