| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 975 人关注过本帖
标题:为什么我做的后台添加文章在本地测试可以,在其他电脑上测试就不一定呢?
取消只看楼主 加入收藏
soag1985
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-12-6
收藏
 问题点数:0 回复次数:3 
为什么我做的后台添加文章在本地测试可以,在其他电脑上测试就不一定呢?

我在自己电脑上浏览,操作后台非常的正常,但是在别的电脑上用我的电脑当服务器时就不可以正常的使用,具体情况时这样的:
我的后台GENGXIN.ASP中内嵌了一个网页EDITOR.HTM,使得我们在后台输入文章的时候可以象在使用WORD一样,想让他怎么样就怎么样,可是,问题来了。
我在我宿舍的电脑上,在楼下校园网用户的电脑上使用均非常的正常,但是拿到老师的电脑上,也是校园网,管理后台的时候就不可以正常的调用EDITOR.HTM文件,以致于我的文章不能正常的输入。
在女生公寓的电脑上使用也不是很正常,总之就是EDITOR.HTM文件调用有问题。
到底是什么方面的原因,谢谢大家了!!!

EDIT.JS

SEP_PADDING = 5
HANDLE_PADDING = 7

var yToolbars = new Array();

var YInitialized = false;

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

var i, s, curr;

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

DoLayout();
window.onresize = DoLayout;

Composition.document.open()
Composition.document.write("<head><style type=\"text/css\">body {font-size: 10.8pt}</style><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><BODY bgcolor=\"#B5E4FB\" MONOSPACE></body>");
Composition.document.close()
Composition.document.designMode="On"
}

function InitBtn(btn)
{
btn.onmouseover = BtnMouseOver;
btn.onmouseout = BtnMouseOut;
btn.onmousedown = BtnMouseDown;
btn.onmouseup = BtnMouseUp;
btn.ondragstart = YCancelEvent;
btn.onselectstart = YCancelEvent;
btn.onselect = YCancelEvent;
btn.YUSERONCLICK = btn.onclick;
btn.onclick = YCancelEvent;
btn.YINITIALIZED = true;
return true;
}

function InitTB(y)
{
y.TBWidth = 0;

if (! PopulateTB(y)) return false;

y.style.posWidth = y.TBWidth;

return true;
}


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

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

if (image.className == "Ico") element.className = "BtnMouseOverUp";
else if (image.className == "IcoDown") element.className = "BtnMouseOverDown";

event.cancelBubble = true;
}

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

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

element.className = "Btn";
image.className = "Ico";

event.cancelBubble = true;
}

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

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

element.className = "BtnMouseOverDown";
image.className = "IcoDown";

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

function 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 = "BtnMouseOverUp";
image.className = "Ico";

event.cancelBubble = true;
return false;
}

function 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 "Btn":
if (element.YINITIALIZED == null) {
if (! InitBtn(element))
return false;
}

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

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

case "TBSep":
element.style.posLeft = y.TBWidth + 2;
y.TBWidth += SEP_PADDING;
break;

case "TBHandle":
element.style.posLeft = 2;
y.TBWidth += element.offsetWidth + HANDLE_PADDING;
break;

default:
return false;
}
}

y.TBWidth += 1;
return true;
}

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

function LayoutTBs()
{
NumTBs = yToolbars.length;

if (NumTBs == 0) return;

var i;
var ScrWid = (document.body.offsetWidth) - 6;
var TotalLen = ScrWid;
for (i = 0 ; i < NumTBs ; i++) {
TB = yToolbars[i];
if (TB.TBWidth > TotalLen) TotalLen = TB.TBWidth;
}

var PrevTB;
var LastStart = 0;
var RelTop = 0;
var LastWid, CurrWid;

var TB = yToolbars[0];
TB.style.posTop = 0;
TB.style.posLeft = 0;

var Start = TB.TBWidth;
for (i = 1 ; i < yToolbars.length ; i++) {
PrevTB = TB;
TB = yToolbars[i];
CurrWid = TB.TBWidth;

if ((Start + CurrWid) > ScrWid) {
Start = 0;
LastWid = TotalLen - LastStart;
}
else {
LastWid = PrevTB.TBWidth;
RelTop -= TB.offsetHeight;
}

TB.style.posTop = RelTop;
TB.style.posLeft = Start;
PrevTB.style.width = LastWid;

LastStart = Start;
Start += CurrWid;
}

TB.style.width = TotalLen - LastStart;

i--;
TB = yToolbars[i];
var TBInd = TB.sourceIndex;
var A = TB.document.all;
var item;
for (i in A) {
item = A.item(i);
if (! item) continue;
if (! item.style) continue;
if (item.sourceIndex <= TBInd) continue;
if (item.style.position == "absolute") continue;
item.style.posTop = RelTop;
}
}

function DoLayout()
{
LayoutTBs();
}

function validateMode()
{
if (! bTextMode) return true;
alert("请取消“使用 HTML 语法书写”选项再使用系统编辑功能!");
Composition.focus();
return false;
}

function format1(what,opt)
{
if (opt=="removeFormat")
{
what=opt;
opt=null;
}

if (opt==null) Composition.document.execCommand(what);
else Composition.document.execCommand(what,"",opt);

pureText = false;
Composition.focus();
}

function format(what,opt)
{
if (!validateMode()) return;

format1(what,opt);
}

function setMode(newMode)
{
bTextMode = newMode;
var cont;
if (bTextMode) {
cleanHtml();
cleanHtml();

cont=Composition.document.body.innerHTML;
Composition.document.body.innerText=cont;
} else {
cont=Composition.document.body.innerText;
Composition.document.body.innerHTML=cont;
}

Composition.focus();
}

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

function UserDialog(what)
{
if (!validateMode()) return;

Composition.document.execCommand(what, true);

pureText = false;
Composition.focus();
}

function foreColor()
{
if (! validateMode()) return;
var arr = showModalDialog("selcolor.htm", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
if (arr != null) format('forecolor', arr);
else Composition.focus();
}

function fortable()
{
if (! validateMode()) return;
var arr = showModalDialog("table.htm", "", "dialogWidth:18.5em; dialogHeight:11.5em; status:0");

if (arr != null){
var ss;
ss=arr.split("*")
row=ss[0];
col=ss[1];
var string;
string="<table border=1>";
for(i=1;i<=row;i++){
string=string+"<tr>";
for(j=1;j<=col;j++){
string=string+"<td></td>";
}
string=string+"</tr>";
}
string=string+"</table>";
content=Composition.document.body.innerHTML;
content=content+string;
Composition.document.body.innerHTML=content;
}
else Composition.focus();
}
function cleanHtml()
{
var fonts = 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 getPureHtml()
{
var str = "";
var paras = 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 = Composition.document.body.innerHTML;
}
return str;
}

var bLoad=false
var pureText=true
var bodyTag="<head><style type=\"text/css\">body {font-size: 10.8pt}</style><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><BODY bgcolor=\"#FFFFFF\" MONOSPACE>"
var bTextMode=false

public_description=new Editor

function Editor()
{
this.put_HtmlMode=setMode;
this.put_value=putText;
this.get_value=getText;
}

function getText()
{
if (bTextMode)
return Composition.document.body.innerText;
else
{
cleanHtml();
cleanHtml();
return Composition.document.body.innerHTML;
}
}

function putText(v)
{
if (bTextMode)
Composition.document.body.innerText = v;
else
Composition.document.body.innerHTML = v;
}

function InitDocument()
{
Composition.document.open();
Composition.document.write(bodyTag);
Composition.document.close();
bLoad=true;
}

function doSelectClick(str, el) {
var Index = el.selectedIndex;
if (Index != 0){
el.selectedIndex = 0;
if (el.id == "specialtype")
specialtype(el.options[Index].value);
else
format(str,el.options[Index].value);
}
}
var bIsIE5 = navigator.userAgent.indexOf("IE 5") > -1;
var edit;
var RangeType;

function specialtype(Mark){
var strHTML;
if (bIsIE5) selectRange();
if (RangeType == "Text"){
strHTML = "<" + Mark + ">" + edit.text + "</" + Mark + ">";
edit.pasteHTML(strHTML);
Composition.focus();
edit.select();
}
}

function selectRange(){
edit = Composition.document.selection.createRange();
RangeType = Composition.document.selection.type;
}

function help()
{
var helpmess;
helpmess="---------------帮助系统---------------\r\n\r\n"+
"1.本系统支持任意贴图,可以再网上随便复制图像,然后粘贴\r\n\r\n"+
"文档中,系统会自动帮您转换成为正常路径\r\n\r\n"+
"3.可以用[img][/img]进行贴图.\r\n\r\n"+
"4.如果要使用html编写请选中工具栏中的“用html语法书写”的选项";
alert(helpmess);

}

function insertflash()
{
if (! validateMode()) return;
var str;
str="";
var st;
st=prompt("请输入flash地址:","");
var w=prompt("请输入flash的宽度:","128");
var h=prompt("请输入flash的高度:","128");
if (st!="")
{
str=str+"<EMBED src='"+st+"' width='"+w+"' height='"+h+"'>";
content=Composition.document.body.innerHTML;
content=content+str;
Composition.document.body.innerHTML=content;
}
else Composition.focus();
}

[此贴子已经被作者于2006-12-6 15:51:41编辑过]

搜索更多相关主题的帖子: 后台 
2006-12-06 15:15
soag1985
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-12-6
收藏
得分:0 
真不愧是版主,我把EDIT.JS也发上,看看毛病到底在哪里?
我也是在借鉴别人的代码,慢慢的形成一套自己的代码的。
EDIT.JS

SEP_PADDING = 5
HANDLE_PADDING = 7

var yToolbars = new Array();

var YInitialized = false;

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

var i, s, curr;

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

DoLayout();
window.onresize = DoLayout;

Composition.document.open()
Composition.document.write("<head><style type=\"text/css\">body {font-size: 10.8pt}</style><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><BODY bgcolor=\"#B5E4FB\" MONOSPACE></body>");
Composition.document.close()
Composition.document.designMode="On"
}

function InitBtn(btn)
{
btn.onmouseover = BtnMouseOver;
btn.onmouseout = BtnMouseOut;
btn.onmousedown = BtnMouseDown;
btn.onmouseup = BtnMouseUp;
btn.ondragstart = YCancelEvent;
btn.onselectstart = YCancelEvent;
btn.onselect = YCancelEvent;
btn.YUSERONCLICK = btn.onclick;
btn.onclick = YCancelEvent;
btn.YINITIALIZED = true;
return true;
}

function InitTB(y)
{
y.TBWidth = 0;

if (! PopulateTB(y)) return false;

y.style.posWidth = y.TBWidth;

return true;
}


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

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

if (image.className == "Ico") element.className = "BtnMouseOverUp";
else if (image.className == "IcoDown") element.className = "BtnMouseOverDown";

event.cancelBubble = true;
}

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

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

element.className = "Btn";
image.className = "Ico";

event.cancelBubble = true;
}

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

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

element.className = "BtnMouseOverDown";
image.className = "IcoDown";

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

function 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 = "BtnMouseOverUp";
image.className = "Ico";

event.cancelBubble = true;
return false;
}

function 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 "Btn":
if (element.YINITIALIZED == null) {
if (! InitBtn(element))
return false;
}

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

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

case "TBSep":
element.style.posLeft = y.TBWidth + 2;
y.TBWidth += SEP_PADDING;
break;

case "TBHandle":
element.style.posLeft = 2;
y.TBWidth += element.offsetWidth + HANDLE_PADDING;
break;

default:
return false;
}
}

y.TBWidth += 1;
return true;
}

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

function LayoutTBs()
{
NumTBs = yToolbars.length;

if (NumTBs == 0) return;

var i;
var ScrWid = (document.body.offsetWidth) - 6;
var TotalLen = ScrWid;
for (i = 0 ; i < NumTBs ; i++) {
TB = yToolbars[i];
if (TB.TBWidth > TotalLen) TotalLen = TB.TBWidth;
}

var PrevTB;
var LastStart = 0;
var RelTop = 0;
var LastWid, CurrWid;

var TB = yToolbars[0];
TB.style.posTop = 0;
TB.style.posLeft = 0;

var Start = TB.TBWidth;
for (i = 1 ; i < yToolbars.length ; i++) {
PrevTB = TB;
TB = yToolbars[i];
CurrWid = TB.TBWidth;

if ((Start + CurrWid) > ScrWid) {
Start = 0;
LastWid = TotalLen - LastStart;
}
else {
LastWid = PrevTB.TBWidth;
RelTop -= TB.offsetHeight;
}

TB.style.posTop = RelTop;
TB.style.posLeft = Start;
PrevTB.style.width = LastWid;

LastStart = Start;
Start += CurrWid;
}

TB.style.width = TotalLen - LastStart;

i--;
TB = yToolbars[i];
var TBInd = TB.sourceIndex;
var A = TB.document.all;
var item;
for (i in A) {
item = A.item(i);
if (! item) continue;
if (! item.style) continue;
if (item.sourceIndex <= TBInd) continue;
if (item.style.position == "absolute") continue;
item.style.posTop = RelTop;
}
}

function DoLayout()
{
LayoutTBs();
}

function validateMode()
{
if (! bTextMode) return true;
alert("请取消“使用 HTML 语法书写”选项再使用系统编辑功能!");
Composition.focus();
return false;
}

function format1(what,opt)
{
if (opt=="removeFormat")
{
what=opt;
opt=null;
}

if (opt==null) Composition.document.execCommand(what);
else Composition.document.execCommand(what,"",opt);

pureText = false;
Composition.focus();
}

function format(what,opt)
{
if (!validateMode()) return;

format1(what,opt);
}

function setMode(newMode)
{
bTextMode = newMode;
var cont;
if (bTextMode) {
cleanHtml();
cleanHtml();

cont=Composition.document.body.innerHTML;
Composition.document.body.innerText=cont;
} else {
cont=Composition.document.body.innerText;
Composition.document.body.innerHTML=cont;
}

Composition.focus();
}

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

function UserDialog(what)
{
if (!validateMode()) return;

Composition.document.execCommand(what, true);

pureText = false;
Composition.focus();
}

function foreColor()
{
if (! validateMode()) return;
var arr = showModalDialog("selcolor.htm", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
if (arr != null) format('forecolor', arr);
else Composition.focus();
}

function fortable()
{
if (! validateMode()) return;
var arr = showModalDialog("table.htm", "", "dialogWidth:18.5em; dialogHeight:11.5em; status:0");

if (arr != null){
var ss;
ss=arr.split("*")
row=ss[0];
col=ss[1];
var string;
string="<table border=1>";
for(i=1;i<=row;i++){
string=string+"<tr>";
for(j=1;j<=col;j++){
string=string+"<td></td>";
}
string=string+"</tr>";
}
string=string+"</table>";
content=Composition.document.body.innerHTML;
content=content+string;
Composition.document.body.innerHTML=content;
}
else Composition.focus();
}
function cleanHtml()
{
var fonts = 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 getPureHtml()
{
var str = "";
var paras = 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 = Composition.document.body.innerHTML;
}
return str;
}

var bLoad=false
var pureText=true
var bodyTag="<head><style type=\"text/css\">body {font-size: 10.8pt}</style><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\"></head><BODY bgcolor=\"#FFFFFF\" MONOSPACE>"
var bTextMode=false

public_description=new Editor

function Editor()
{
this.put_HtmlMode=setMode;
this.put_value=putText;
this.get_value=getText;
}

function getText()
{
if (bTextMode)
return Composition.document.body.innerText;
else
{
cleanHtml();
cleanHtml();
return Composition.document.body.innerHTML;
}
}

function putText(v)
{
if (bTextMode)
Composition.document.body.innerText = v;
else
Composition.document.body.innerHTML = v;
}

function InitDocument()
{
Composition.document.open();
Composition.document.write(bodyTag);
Composition.document.close();
bLoad=true;
}

function doSelectClick(str, el) {
var Index = el.selectedIndex;
if (Index != 0){
el.selectedIndex = 0;
if (el.id == "specialtype")
specialtype(el.options[Index].value);
else
format(str,el.options[Index].value);
}
}
var bIsIE5 = navigator.userAgent.indexOf("IE 5") > -1;
var edit;
var RangeType;

function specialtype(Mark){
var strHTML;
if (bIsIE5) selectRange();
if (RangeType == "Text"){
strHTML = "<" + Mark + ">" + edit.text + "</" + Mark + ">";
edit.pasteHTML(strHTML);
Composition.focus();
edit.select();
}
}

function selectRange(){
edit = Composition.document.selection.createRange();
RangeType = Composition.document.selection.type;
}

function help()
{
var helpmess;
helpmess="---------------帮助系统---------------\r\n\r\n"+
"1.本系统支持任意贴图,可以再网上随便复制图像,然后粘贴\r\n\r\n"+
"文档中,系统会自动帮您转换成为正常路径\r\n\r\n"+
"3.可以用[img][/img]进行贴图.\r\n\r\n"+
"4.如果要使用html编写请选中工具栏中的“用html语法书写”的选项";
alert(helpmess);

}

function insertflash()
{
if (! validateMode()) return;
var str;
str="";
var st;
st=prompt("请输入flash地址:","");
var w=prompt("请输入flash的宽度:","128");
var h=prompt("请输入flash的高度:","128");
if (st!="")
{
str=str+"<EMBED src='"+st+"' width='"+w+"' height='"+h+"'>";
content=Composition.document.body.innerHTML;
content=content+str;
Composition.document.body.innerHTML=content;
}
else Composition.focus();
}
2006-12-06 15:46
soag1985
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-12-6
收藏
得分:0 
那我如果想要一个适合2000,IE5以上的浏览器都可以使用的EDIT.JS,应该怎么修改啊?
2006-12-06 15:50
soag1985
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-12-6
收藏
得分:0 
斑竹就是斑竹,一看就真的毛病在哪里,现在已经将EDITOR.HTM改成EDIT.JS了,希望大家给一个好的建议,我也是想综合网络上提供的代码,形成一套自己的代码的。
2006-12-06 15:53
快速回复:为什么我做的后台添加文章在本地测试可以,在其他电脑上测试就不一定呢 ...
数据加载中...
 
   



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

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