为什么老提示 'rmopo' 未定义?

weilun 2008-08-22 06:57:05
这段程序是我从网上下的,以前用没什么问题,可是现在却提示 rmopo 未定义。我第一行不就定义了吗?我估计是字符编码出现问题了。哪位高手能帮我看看到底是哪出了问题,多谢了。
<!--Combobox-->
function combobox(sobj,obj2,obj3,obj4,obj5,obj6,obj7,al_v,al_t,zhiwu,youxiang,shouji,dianhua,dizhi,bumen)
{

var rmopo = window.createPopup();

function rm(i,oct,h)
{
var i2=eval(i);
var oct=eval(oct);
var w=eval(i).offsetWidth;
var h=eval(h);
var lefter = i2.offsetLeft-1; var topper = i2.offsetHeight;
rmopo.document.body.innerHTML = oct.innerHTML;
rmopo.document.body.style.border="1px solid #3162A6";
rmopo.document.body.style.background="#F6F6F6";
rmopo.show(lefter, topper, w, h, i2);
}

loadcombobox(sobj,obj2,obj3,obj4,obj5,obj6,obj7,al_v,al_t,zhiwu,youxiang,shouji,dianhua,dizhi,bumen);

function loadcombobox(obj,obj2,obj3,obj4,obj5,obj6,obj7,al_v,al_t,zhiwu,youxiang,shouji,dianhua,dizhi,bumen)
{
var obj = eval(obj)
var obj2 = eval(obj2)
var obj3 = eval(obj3)
var obj4 = eval(obj4)
var obj5 = eval(obj5)
var obj6 = eval(obj6)
var obj7 = eval(obj7)
theListArrayV = al_v;
theListArrayT = al_t;
theListArrayZhiwu=zhiwu;
theListArrayYouxiang=youxiang;
theListArrayShouji=shouji;
theListArrayDianhua=dianhua;
theListArrayDizhi=dizhi;
theListArrayBumen=bumen;

var tempStr='<DIV id="'+obj.id+'showcombox" style="position:relative;visibility:hidden">'
+'<DIV class="ac_menu" id="'+obj.id+'ListDiv" style="FONT-SIZE: 12px; Z-INDEX: 10; POSITION: absolute;OVERFLOW-Y:auto; WIDTH:expression('+obj.offsetWidth+'-1);">'
for(var i=0;i<theListArrayV.length;i++)
tempStr+='<DIV class="ac_menuitem" onmouseover="this.style.backgroundColor=\'#D6DEEC\';" onmouseout="this.style.backgroundColor=\'\';" onclick="this.selectedflag=1;parent.document.all.'+obj.id+'.value=this.value;parent.document.all.'+obj2.id+'.value=\''+htmlEncode(theListArrayZhiwu[i])+'\';parent.document.all.'+obj3.id+'.value=\''+htmlEncode(theListArrayYouxiang[i])+'\';parent.document.all.'+obj4.id+'.value=\''+htmlEncode(theListArrayShouji[i])+'\';parent.document.all.'+obj5.id+'.value=\''+htmlEncode(theListArrayDianhua[i])+'\';parent.document.all.'+obj6.id+'.value=\''+htmlEncode(theListArrayDizhi[i])+'\';parent.document.all.'+obj7.id+'.value=\''+htmlEncode(theListArrayBumen[i])+'\';parent.document.all.'+obj.id+'.blur();" style="cursor:default;" value="'+htmlEncode(theListArrayV[i])+'" textvalue="'+htmlEncode(theListArrayT[i])+'">'+htmlEncode(theListArrayT[i])+'</DIV>';
tempStr+='</DIV></DIV>';

obj.insertAdjacentHTML("afterEnd",tempStr);
obj.onfocus=AC_OnFocus;
obj.onclick=AC_OnFocus;
obj.onblur=AC_OnBlur;
obj.onkeydown=AC_OnKeyDown;
obj.autoComplete="off";
obj.onpropertychange=AC_OnPropertyChange;
}

function AC_OnFocus(obj)
{
if(obj==null) obj=event.srcElement;
popmenu=eval(obj.id+"showcombox");
rm(obj,popmenu,130);
AC_OnPropertyChange(obj);
}


function AC_OnBlur(obj)
{
rmopo.hide();
}

function AC_OnPropertyChange(obj)
{
if(obj==null) obj=event.srcElement;

var dv = eval("rmopo.document.all['"+obj.id+"ListDiv']");
theListDiv = dv
if(theListDiv==null) return ;
var theListDivChildren=theListDiv.children;

theListDiv.selectedIndex=-1;
var theFirstVisibleIndex=-1;

var objValue=obj.value;

for(var i=0;i<theListDivChildren.length;i++)
{
if(theListDiv.children[i].textvalue.indexOf(objValue)==0)
{
if(theFirstVisibleIndex==-1) theFirstVisibleIndex=i;
theListDivChildren[i].style.backgroundColor="#F6F6F6";
theListDivChildren[i].style.display="";
}
else
theListDivChildren[i].style.display="none";
if(theListDiv.selectedIndex==-1 && theListDiv.children[i].textvalue==objValue)
{
theListDiv.selectedIndex=i;
}
}
if(theListDiv.selectedIndex==-1 && theFirstVisibleIndex!=-1)
{
theListDiv.selectedIndex=theFirstVisibleIndex;
}
if(theListDiv.selectedIndex!=-1)
{
theListDiv.children[theListDiv.selectedIndex].style.backgroundColor="#D6DEEC";
}
adjustListDivScroll(obj);
}

function AC_OnKeyDown(obj)
{
if(obj==null) obj=event.srcElement;

var AC_TAB = 9;
var AC_ENTER = 13;
var AC_UP_ARROW = 38;
var AC_DOWN_ARROW = 40;

var dv = eval("rmopo.document.all['"+obj.id+"ListDiv']");
theListDiv = dv
if(theListDiv==null) return ;

var keyCode=event.keyCode;
if(keyCode==AC_ENTER) keyCode=event.keyCode=AC_TAB;

if(keyCode==AC_TAB && theListDiv.selectedIndex!=-1)
{
obj.value=theListDiv.children[theListDiv.selectedIndex].value;
rmopo.hide() ;
}

if(keyCode==AC_UP_ARROW && theListDiv.selectedIndex!=-1)
{
for(var i=theListDiv.selectedIndex-1;i>-1;i--)
{
if(theListDiv.children[i].style.display!="none")
{
theListDiv.children[theListDiv.selectedIndex].style.backgroundColor="#F6F6F6";
theListDiv.selectedIndex=i;
theListDiv.children[theListDiv.selectedIndex].style.backgroundColor="#D6DEEC";
adjustListDivScroll(obj);
break;
}
}
}

if(keyCode==AC_DOWN_ARROW && theListDiv.selectedIndex!=-1)
{
for(var i=theListDiv.selectedIndex*1+1;i<theListDiv.children.length;i++)
{
if(theListDiv.children[i].style.display!="none")
{
theListDiv.children[theListDiv.selectedIndex].style.backgroundColor="#F6F6F6";
theListDiv.selectedIndex=i;
theListDiv.children[theListDiv.selectedIndex].style.backgroundColor="#D6DEEC";
adjustListDivScroll(obj);
break;
}
}
return;
}

}

function adjustListDivScroll(obj)
{
if(obj==null) obj=event.srcElement;

var dv = eval("rmopo.document.all['"+obj.id+"ListDiv']");
theListDiv = dv

if ( theListDiv==null || theListDiv.selectedIndex==-1 ) return ;
var i=theListDiv.selectedIndex;
if((theListDiv.children[i].offsetTop<theListDiv.scrollTop)||(theListDiv.children[i].offsetTop>theListDiv.scrollTop+120))
theListDiv.scrollTop=theListDiv.children[i].offsetTop-85;
}

function htmlEncode(str)
{
if(str==null) return "";
str=str.replace(/</ig,"<")
str=str.replace(/>/ig,">");
str=str.replace(/"/ig,""");
return str;
}
}
<!--end-->
...全文
156 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq162753515 2012-09-28
  • 打赏
  • 举报
回复
JS引用出错了
weilun 2008-09-02
  • 打赏
  • 举报
回复
我发现前台的输入框用.net的组件<asp:TextBox ID= .....>,调用combobox(document.all.textname,....)函数就会出现这个错误,而改成<input type=text id= ......>就没问题,谁知道这两种有什么区别,调用函数时有什么不一样的吗?
weilun 2008-08-27
  • 打赏
  • 举报
回复
哪位高手能帮我看看吗?window.createPopup()是系统函数,可以直接调用,不用定义。不知问题出在什么地方。
weilun 2008-08-26
  • 打赏
  • 举报
回复
window.createPopup()是系统函数,可以直接调用,不用定义。
sxn19811006 2008-08-25
  • 打赏
  • 举报
回复
alert(createPopup)
sxn19811006 2008-08-25
  • 打赏
  • 举报
回复
这些js是怎么调的?
sxn19811006 2008-08-25
  • 打赏
  • 举报
回复
有createPopup
街头小贩 2008-08-25
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 weilun 的回复:]
怎么定义呢?楼上的能说的清楚点吗?
[/Quote]
JS有这个东东么?window.createPopup();
你提供的代码中我也没看到在哪有定义这个的
rczjp 2008-08-25
  • 打赏
  • 举报
回复
应该还有一些JS,LZ没有下载下来
weilun 2008-08-25
  • 打赏
  • 举报
回复
各位有懂得吗,我急用,多谢了,分不够可以再给。
lihanxin84 2008-08-23
  • 打赏
  • 举报
回复
好像是哦!只是初始化了!但并未定义!
weilun 2008-08-23
  • 打赏
  • 举报
回复
而且这段代码怎么不支持键盘操作呢?
weilun 2008-08-23
  • 打赏
  • 举报
回复
怎么定义呢?楼上的能说的清楚点吗?
victarary 2008-08-22
  • 打赏
  • 举报
回复
var rmopo = window.createPopup(); 中的window.createPopup函数在整个程序中我都没有见到定义!

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧