469,331 Members | 4,161 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

Microsoft JScript runtime error: 'ol' is null or not an object

39
Hi

Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept inside the folder "menu_script".


The following is the code in this file.
Expand|Select|Wrap|Line Numbers
  1. var menuOffsetTop=menuOffsetLeft=submenuOffsetTop=submenuOffsetLeft=submenuOffsetRight=0;
  2. var Doc=this.document;var standards=Doc.createElement&&Doc.createTextNode?1:0;
  3. function Browser()
  4. {
  5. var n=navigator.userAgent,d=Doc;
  6.  
  7. //this.ie7=(n.indexOf("MSIE 7.0")>0);
  8. this.ie6=(n.indexOf("MSIE 6.0")>0);
  9. this.ie=(n.indexOf("MSIE 5")>0||!this.ie6);
  10. this.ie5=(n.indexOf("MSIE 5.0")>0);
  11. this.m=(n.indexOf("Mac")>0);
  12. this.mIE=(this.m&&!this.ie);
  13. this.wIE=(this.ie&&!this.m);
  14. this.ns=(n.indexOf("Gecko")>0);
  15. this.css1=(!d.compatMode&&!this.mIE||d.doctype&&d.doctype.name.indexOf("/TR/")>-1||"CSS1Compat"==d.compatMode);
  16. if(this.wIE&&!this.ie6)
  17. this.css1=0;
  18. this.moz=this.ns&&!(n.indexOf("Netscape")>0);
  19. this.minNS61=(this.moz||this.ns&&n.indexOf("6.")!=-1&&parseInt(n.substr(n.indexOf("6.")+2,1))>1);
  20. }
  21. this.bw=new Browser();
  22. glut={ml:[],ll:[],RMM:null,LMM:null,BMM:null,db:null,am:null,fb:0,mo:0,er:"<tr><td style='height: 0px;'></td></tr>"};
  23. window.onresize=function()
  24. {
  25. setTimeout("ump()",100);};
  26. Doc.onmouseup=rM;
  27. function rM(e)
  28. {
  29.  
  30. e=e?e:window.event;
  31. var t=e.srcElement?e.srcElement:e.target;
  32. //alert(e.srcElement);
  33. if(t.nodeName=="#text")t=t.parentNode;
  34. if(!t.className||glut.db&&t.className.indexOf("buttons")!=0||!ct(t.menubar,glut.db))
  35. if(glut.db)rs(glut.db,"buttons");
  36. else if(glut.am)rs(glut.am.ob);}
  37. this.menubar=null;
  38. function Menubar(id)
  39. {
  40. menubar=div();
  41. menubar.buttons=[];
  42. menubar.id=id?id:"menubar";
  43. menubar.className="menubar";
  44. menubar.add=add;
  45. //menubar.addText=addText;
  46. menubar.addMenu=menubarAddMenu;
  47. menubar.add(fix());
  48. menubar.moveByY=moveByY;
  49. menubar.setWidth=menubarSetWidth;
  50. menubar.keepOnTop=keepOnTop;
  51. menubar.sb=0;
  52. menubar.fb=0;
  53. menubar.useMouseOver=function(on)
  54. {
  55. glut.mo=(on==false)?0:1};fixHeight(menubar);
  56. menubar.onmouseout=function(e)
  57. {
  58. if(!glut.mo||!glut.db)return;
  59. e=e?e:window.event;
  60. if(e.nodeName=="#text")e=e.parentNode;
  61. var rt=e.relatedTarget?e.relatedTarget:e.toElement;
  62. var t=e.currentTarget?e.currentTarget:e.srcElement;
  63. if(ct(document.documentElement,rt)&&!ct(this,rt)&&!ct(glut.db.m,rt))rs(glut.db,"buttons");
  64. };
  65. eval(menubar.id+"=menubar");
  66. return menubar;
  67. }
  68. function fix()
  69. {
  70. var f=div();
  71. with(f){className="buttons";
  72. with(style){width=0;margin=0;
  73. if(!bw.wIE)border=0;padding=0;fontSize=0;visibility="hidden";
  74. };
  75. };
  76. return f;
  77. }
  78. function add(mbi)
  79. {
  80. if(typeof mbi=="string")
  81. this.addText(mbi);
  82. else if(mbi.className=="menu")
  83. this.addMenu(mbi);
  84. else if(mbi.isSb)
  85. {
  86. this.sb=1;
  87. if(bw.wIE){mbi=Doc.body.appendChild(mbi);
  88. mbi.style.height=(mbi.firstChild.offsetHeight)+'px';
  89. mbi.style.overflow="hidden";
  90. mbi=Doc.body.removeChild(mbi);
  91. }
  92. if
  93. (
  94. bw.ns
  95. )
  96. mbi.getElementsByTagName("input")[0].style.marginBottom="7px";
  97. var addH=(bw.wIE&&bw.ie6)?2:1;
  98. if
  99. (
  100. this.style.height<mbi.offsetHeight)this.style.height=(mbi.offsetHeight+addH)+"px";
  101. this.appendChild(mbi);
  102. }
  103. else 
  104. this.appendChild(mbi);
  105. if(
  106. bw.mIE
  107. )
  108. {
  109. x=fix();
  110. x.style.width="1px";
  111. this.appendChild(x);
  112. }
  113. }
  114. //function Searchbox(value,action,formId,inputName)
  115. //{
  116. //var d=div();
  117. ////var sm=(bw.mIE)?"":"font-size:smaller;";
  118. //if
  119. //(
  120. //bw.mIE
  121. //)
  122. //{
  123. //d.style.width="8px";
  124. //}
  125. //if
  126. //(
  127. //bw.ns
  128. //)
  129. //d.style.cssFloat="left";
  130. //else d.style.styleFloat="left";
  131. //d.style.padding="0";
  132. //var form="<form onmouseup='event.cancelBubble=true' style='display:inline;width:0;padding:0;margin:0;white-space:nowrap;' action='"+action+"' id='"+formId+"'><input type='txt' onfocus=\"status='"+value+"'\" onblur='status=defaultStatus' style='display:inline;cursor:text;"+sm+"' size='12' name='"+inputName+"' id='"+formId+"Field' /><button type='submit' style='"+sm+"' value='"+value+"'>"+value+"</button></form>";
  133. //if(bw.ie)form+=fix().outerHTML;
  134. //d.innerHTML=form;
  135. //d.isSb=1;
  136. //return d;
  137. //}
  138. function Button
  139. (
  140. txt,u,id
  141. )
  142. {
  143. var b,link=0;
  144. if
  145. (
  146. arguments.length>=2
  147. )
  148. {
  149. b=Doc.createElement("a");
  150. b.href=u;
  151. if(arguments[1].indexOf(".")==-1)
  152. alert("ERROR:\nInvalidconstructor:newButton("+arguments[0]+","+arguments[1]+")"+"\nThesecondargumentmustbeaURL"+"\nAurlmusthavea\".\"character");
  153. b.id=id;
  154. link=1;
  155. }
  156. if(!link)
  157. {
  158. b=div();
  159. b.onmouseover=buttonOver;
  160. if(!glut.mo)
  161. {
  162. b.onclick=buttonClick;
  163. b.onmouseout=buttonOut;
  164. }
  165. else b.onmousedown=buttonClick;
  166. }
  167. b.className="buttons";
  168. b.innerHTML=txt;
  169. b.menuOffsetTop=menuOffsetTop;
  170. b.mol=menuOffsetLeft;
  171. b.mor=0;
  172. return b;
  173. }
  174. function Label(txt)
  175. {
  176. var l=div();
  177. l.txt=txt;
  178. l.className="label";
  179. l.style.position="relative";
  180. l.style.whiteSpace="nowrap";
  181. if(!bw.ie)
  182. l.style.width="auto";
  183. if(bw.wIE&&bw.ie6)
  184. l.style.width="100%";
  185. l.innerHTML=txt;
  186. l.m=null;
  187. l.onmouseover=labelOver;
  188. l.onmouseup=function(e)
  189. {
  190. e=e?e:window.event;
  191. e.cancelBubble=true;
  192. };
  193. l.menuOffsetTop=submenuOffsetTop;
  194. l.mol=submenuOffsetRight;
  195. l.mor=submenuOffsetLeft;
  196. if(bw.mIE)
  197. l.innerHTML+="</td><td><span isArrow=1 style='position:absolute;top:0;right:0;margin:0;font-family:";//+glut.arrowFont+";font-weight:900'>"+glut.arrowText+"</span></td>";
  198. glut.ll[glut.ll.length]=l;
  199. return l;
  200. }
  201. function Menu(titl)
  202. {
  203. M=div();
  204. M.lt=titl;
  205. M.id="Menu"+glut.ml.length;
  206. M.className="menu";
  207. M.appendChild(T());
  208. M.table=(bw.mIE)?M.firstChild:M.firstChild.firstChild;M.addItem=addItem;
  209. M.addSeparator=addSeparator;
  210. M.addMenu=addMenu;
  211. M.setWidth=function(w)
  212. {
  213. var px="";
  214. if
  215. (typeof w=="number")
  216. px="px";
  217. this.style.width=w+px;
  218. };
  219. M.add=function(o)
  220. {
  221. if(!o)
  222. return;
  223. if(o.addItem!=null)
  224. this.addMenu(o);
  225. else if(o.tagName!="TR")
  226. {
  227. if(o.isSb)
  228. {
  229. if(bw.mIE)
  230. this.table.insertAdjacentHTML("BeforeEnd",glut.er);
  231. else if(bw.ns)o.firstChild.firstChild.style.marginBottom="6px";
  232. }
  233. if(bw.mIE&&bw.ie50&&o.isSb)
  234. this.table.insertAdjacentHTML("BeforeEnd","<tr><td>"+o.innerHTML+"</td></tr>");
  235. else this.table.appendChild(cwo(o));
  236. }
  237. else if(o.className!="buttons")
  238. this.addItem(o);
  239. };
  240. M.om=null;
  241. M.as=null;
  242. M.help="";
  243. M.isPos=0;
  244. M.stk=1000;
  245. glut.ml[glut.ml.length]=M;
  246. return Doc.body.appendChild(M);
  247. }
  248. function addMenu(m)
  249. {
  250. l=Label(m.lt);
  251. l.om=this;
  252. l.m=m;
  253. l.help=m.help;
  254. l.m.ol=l;
  255. l.m.om=this;
  256. addLabel(this,l);
  257. }
  258. function addMenuOrItem(txt,u,id)
  259. {
  260. if(arguments[0].className)
  261. this.addMenu(arguments[0]);
  262. else this.addItem(txt,u,id);
  263. }
  264. function menubarAddMenu(m)
  265. {
  266. var b=m.ob=this.buttons[this.buttons.length++]=Button(m.lt);b.m=m;
  267. b.id=this.id+"B"+this.buttons.length;
  268. b.menubar=b.m.menubar=this;
  269. if(!this.hasAMenu)
  270. m.style.marginLeft="-1px";
  271. b.msg=m.lt;
  272. this.appendChild(b);
  273. if(bw.mIE&&!this.sb&&this.hasAMenu)
  274. this.appendChild(fix());this.hasAMenu=1;
  275. }
  276. function addText(txt)
  277. {
  278. d=div();
  279. d.className="buttons";
  280. d.innerHTML=txt;
  281. this.appendChild(d);
  282. }
  283. function addItem(o)
  284. {
  285. o.firstChild.firstChild.om=this;
  286. if(bw.mIE)
  287. this.table.insertAdjacentHTML("BeforeEnd",glut.er);
  288. this.table.appendChild(o);
  289. }
  290. function MenuItem(txt,u)
  291. {
  292. var a=Doc.createElement("a");
  293. a.className="menuItem";
  294. a.onmouseover=itemOver;
  295. if(u)a.setAttribute("href",u);
  296. if(!bw.wIE)a.style.width="auto";
  297. a.innerHTML=txt;
  298. return cwo(a);
  299. }
  300. function addLabel(m,l)
  301. {
  302. c=cwo(l);
  303. if(bw.ie6)
  304. {
  305. c.onmouseover=function()
  306. {
  307. if(!this.wideEnoughForIE6)
  308. {
  309. l.style.width=l.offsetWidth-parseInt(l.currentStyle.paddingLeft)-parseInt(l.currentStyle.paddingRight);
  310. this.wideEnoughForIE6=1;
  311. }
  312. }
  313. }
  314. else if(bw.wIE)
  315. l.style.width="88%";
  316. if(bw.mIE)
  317. {
  318. m.table.insertAdjacentHTML("BeforeEnd",glut.er);
  319. l.style.width="auto";
  320. }
  321. negArrowHeight=(bw.wIE)?-2:0;
  322. m.table.appendChild(c);
  323. if(!bw.mIE)
  324. /l.innerHTML+="<span style='position:absolute;top:0;margin:0;line-height:"+(l.parentNode.offsetHeight+negArrowHeight)+"px;right:0;font-family:";//+glut.arrowFont+";font-weight:900' isArrow=1>"+glut.arrowText+"</span>";
  325. else l.getElementsByTagName("span")[0].style.lineHeight=18+"px";
  326. }
  327. function addSeparator(c)
  328. {
  329. var sep=div();
  330. sep.className="separator";
  331. with(sep.style)
  332. {
  333. height=0;fontSize=0;lineHeight=0;
  334. if(!bw.ie)width="auto";
  335. if(!c)
  336. {
  337. borderTop="1px solid ThreeDShadow";
  338. borderBottom="1px solid ThreeDHighlight";
  339. }
  340. else if(bw.ie)
  341. border="1px groove "+c;
  342. else borderBottom="2px groove "+c;
  343. }
  344. if(bw.mIE)
  345. this.table.insertAdjacentHTML("BeforeEnd",glut.er);
  346. this.table.appendChild(cwo(sep));
  347. if(bw.ie6)sep.style.marginBottom=(parseInt(sep.currentStyle.marginBottom)-2)+"px";
  348. //if(bw.mIE)sep.style.marginTop=(parseInt(sep.currentStyle.marginTop)-2)+"px";
  349. }
  350. function menubarSetWidth(w,i)
  351. {
  352. this.style.width=w;
  353. if(typeof i!="number")
  354. i=2;
  355. i-=bw.css1?2:0;
  356. this.style.width=(this.offsetWidth+i)+"px";
  357. }
  358. //function setArrow(f,t)
  359. //{
  360. //glut.arrowFont=f;
  361. //glut.arrowText=t;
  362. //for(var i=0;i<glut.ll.length;i++)
  363. //{
  364. //var spans=glut.ll[i].getElementsByTagName("span");
  365. //var arr=spans[0];
  366. //if(arr&&Boolean(arr.isArrow||arr.getAttribute("isArrow")))
  367. //{
  368. //arr.innerHTML="<span style='margin:0;font-family:"+f+"'>"+t+"</span>";
  369. //}
  370. //}
  371. //}
  372. function T()
  373. {
  374. var t=Doc.createElement("table");
  375. t.cellPadding=0;t.cellSpacing=0;t.style.margin=0;
  376. if(!bw.mIE)
  377. t.appendChild(Doc.createElement("tbody"));
  378. return t;
  379. }
  380. function cwo(o)
  381. {
  382. r=Doc.createElement("tr");
  383. c=Doc.createElement("td");
  384. c.appendChild(o);
  385. r.appendChild(c);
  386. return r
  387. }
  388. function div()
  389. {
  390. return Doc.createElement("div");
  391. }
  392. function getObj(s)
  393. {
  394. return typeof s=="string"?Doc.getElementById(s):s;
  395. }
  396. function fixHeight(mb)
  397. {
  398. var b=Doc.body.appendChild(Button());
  399. var h=b.offsetHeight;
  400. h+=bw.css1?2:4;
  401. mb.style.height=h+"px";
  402. if(bw.ns)mb.style.clip="auto";
  403. Doc.body.removeChild(b);
  404. }
  405. function getTop(o)
  406. {
  407. if(bw.ie)
  408. return o.style.posTop;
  409. else return parseInt(Doc.defaultView.getComputedStyle(o,'').getPropertyValue('top'));
  410. }
  411. function ct(a,b)
  412. {
  413. return b?(b==a)?1:ct(a,b.parentNode):0;
  414. }
  415. function getOffset(el,offset)
  416. {
  417. return el[offset]+(el.offsetParent?getOffset(el.offsetParent,offset):0);
  418. }
  419. function gsl()
  420. {
  421. if(bw.ie)
  422. return(Doc.body.scrollLeft);
  423. if(bw.ie6)
  424. return(Doc.documentElement.scrollLeft);
  425. else return(window.pageXOffset);
  426. }
  427. function gst()
  428. {
  429. if(bw.ns)
  430. return(window.pageYOffset);
  431. if(bw.ie6)
  432. return(Doc.documentElement.scrollTop);
  433. return(Doc.body.scrollTop);
  434. }
  435. function gvw()
  436. {
  437. if(bw.ie6)
  438. return Doc.documentElement.clientWidth;
  439. return(window.innerWidth)?window.innerWidth-18:Doc.body.clientWidth-2;
  440. }
  441. function getVH()
  442. {
  443. if(bw.ns)
  444. return window.innerHeight-18;
  445. if(bw.ie6)
  446. return Doc.documentElement.clientHeight;
  447. return Doc.body.clientHeight-2;
  448. }
  449. function moveByY(deltaY)
  450. {
  451. this.style.top=parseInt(this.style.top)+deltaY+"px";
  452. }
  453. function buttonOver(e)
  454. {
  455. if(glut.db==this)
  456. return;
  457. else if(glut.am&&!ct(this.menubar,glut.am.ob))
  458. {
  459. this.className="buttonsOver";
  460. return;
  461. }
  462. if(this.m&&!this.m.ob||this.m.ob!=this)this.m.ob=this;
  463. sp(this.m);
  464. if(glut.db||glut.mo)
  465. {
  466. if(glut.db)rs(glut.db,"buttons");
  467. if(glut.am)rM();
  468. blmo(this,e);
  469. dp(this);
  470. glut.db=this;
  471. }
  472. else this.className="buttonsOver";
  473. window.status=this.m.help?this.msg+": "+this.m.help:this.msg;
  474. }
  475. function buttonClick(e)
  476. {
  477. if(glut.mo)return;
  478. if(glut.am&&glut.am!=this.m)rM();
  479. if(this==glut.db)rs(this,"buttonOver");
  480. else
  481. {
  482. blmo(this,e);
  483. this.m.ob=this;
  484. sp(this.m);
  485. dp(this);
  486. glut.db=this;
  487. }
  488. if(bw.mIE)
  489. this.style.cursor="default";
  490. }
  491. function buttonOut(e)
  492. {
  493. if(glut.db==this)
  494. return;
  495. this.className="buttons";
  496. window.status=window.defaultStatus;
  497. }
  498. function dp(b)
  499. {
  500. b.className="buttonsDown";
  501. b.m.style.visibility="visible";
  502. glut.am=b.m;
  503. glut.db=this;
  504. if(bw.ns)b.m.style.height="";
  505. }
  506. function rs(b,cn)
  507. {
  508. if(b)
  509. {
  510. if(cn)b.className=cn;
  511. b.m.style.visibility="hidden";
  512. if(b.m.as)
  513. rsm(b.m.as);
  514. }
  515. glut.db=null;
  516. glut.am=null;
  517. }
  518. function blmo(bl,e)
  519. {
  520. if(glut.mo)bl.m.onmouseout=hm;
  521. else bl.m.onmouseout=no;
  522. }
  523. function labelOver(e)
  524. {
  525. sp(this.m);
  526. if(this.m.ob)
  527. this.m.ob=null;
  528. this.className="labelOver";
  529. if(this.om.as&&this.om.as!=this.m)
  530. rsm(this.om.as);
  531. this.m.om.as=this.m;
  532. blmo(this,e);
  533. window.status=this.txt;
  534. this.m.style.visibility="visible";
  535. if(bw.mIE)Doc.body.appendChild(div());
  536. else if(bw.ns)
  537. this.m.style.height="";
  538. }
  539. function rsm(m)
  540. {
  541. //if(m.as)rsm(m.as);
  542. if(m.ol)
  543. {
  544. m.ol.className="label";
  545. m.om.as=null;
  546. }
  547. m.style.visibility="hidden";
  548. window.status=window.defaultStatus;
  549. }
  550. function itemOver(e)
  551. {
  552. if(this.om.as)
  553. {
  554. rsm(this.om.as);
  555. this.om.as=null;
  556. }
  557. }
  558. function sp(m)
  559. {
  560. var b=m.ob?1:0;
  561. var l=m.ol?1:0;
  562. var uf=glut.fb&&bw.minNS61||bw.moz;m.bl=b?m.ob:m.ol?m.ol:null;
  563. if(m.isPos&&(l||b)&&!(bw.ie&&glut.fb))
  564. return;
  565. var vw=gvw();
  566. if(!uf)vw+=gsl();
  567. var vh=getVH();
  568. if(!uf)vh+=gst();
  569. buttonHeight=m.bl.offsetHeight,buttonWidth=l?m.ol.offsetWidth:0,buttonLeft=getOffset(m.bl,"offsetLeft"),bot=m.bl?getOffset(m.bl,"offsetTop"):0;
  570. if(uf)m.style.position="fixed";
  571. bot+=m.bl.menuOffsetTop;
  572. ypos=bot;
  573. m.right=m.offsetLeft+m.offsetWidth;
  574. m.bottom=ypos+m.offsetHeight;
  575. var mp,rp,lp,rvo=0,lvo=0;
  576. rp=buttonLeft+buttonWidth;
  577. rp+=m.bl.mol;
  578. lp=buttonLeft-m.offsetWidth;
  579. lp-=m.bl.mor;
  580. if(bw.mIE&&l)
  581. {
  582. rp-=parseInt(m.bl.currentStyle.paddingRight)||0;
  583. lp-=parseInt(m.bl.currentStyle.paddingLeft)||0;
  584. }
  585. if(!b)
  586. if
  587. (rp+m.offsetWidth>vw)rvo=(rp+m.offsetWidth)-vw;
  588. if(lp<0)lvo=-lp;
  589. if(rvo>=0&&rvo<=lvo)
  590. {
  591. mp=rp;
  592. m.iar=1;
  593. glut.RMM=glut.RMM?(m.right>glut.RMM.right)?m:glut.RMM:m;
  594. }
  595. else
  596. {
  597. mp=lp;
  598. m.iar=0;
  599. glut.LMM=glut.LMM?(m.offsetLeft>glut.LMM.offsetLeft)?m:glut.LMM:m;
  600. }
  601. if(!isNaN(mp))m.style.left=mp+"px";
  602. if(!m.iar&&lvo>0)m.style.left="0px";
  603. if(m.iar&&rvo>0){m.overlap=rvo;urp(m);
  604. }
  605. m.stk=m.om?m.om.stk+100:10000;
  606. m.style.zIndex=m.stk;
  607. if(!isNaN(bot))m.style.top=bot+buttonHeight+"px";
  608. if(m.bottom>vh){m.vOverlap=m.bottom-vh;ubp(m);
  609. }
  610. if(m.top<0)m.style.top="0px";
  611. if(m.as)sp(m.as);glut.BMM=getBMM(getRM(m));
  612. if(b&&m.bl.className&&m.bl.className.indexOf("buttons")==0)
  613. m.isPos=1;
  614. }
  615. function getRM(m)
  616. {
  617. return m.om?getRM(m.om):m;
  618. }
  619. function getBMM(m)
  620. {
  621. if(!m.as)
  622. return m;
  623. else
  624. {
  625. glut.BMM=(m.bottom>=m.as.bottom)?m:m.as;getBMM(m.as);
  626. }return m;
  627. }
  628. function urp(m)
  629. {
  630. m.style.left=getOffset(m,"offsetLeft")-m.overlap+2+"px";
  631. }
  632. function ubp(m)
  633. {
  634. m.style.top=getOffset(m,"offsetTop")-m.vOverlap-((m.ol)?m.ol.offsetHeight:2)+"px";
  635. }
  636. function ump(e)
  637. {
  638. var m=glut.ml;
  639. for(var i=0;i<glut.ml.length;i++)
  640. m[i].isPos=0;
  641. if(glut.RMM)sp(glut.RMM);
  642. if(glut.BMM)sp(glut.BMM);
  643. if(glut.LMM)sp(glut.LMM);}
  644. function showMenu(m,event)
  645. {
  646. if(m.style.visibility=="visible")
  647. return false;
  648. if(glut.db)rs(glut.db,"buttons");
  649. if(glut.am)
  650. {
  651. glut.am.style.visibility="hidden";
  652. glut.am=null;
  653. }
  654. m=getObj(m),
  655. scrollTop=gst(),
  656. scrollLeft=gsl(),
  657. menuWidth=m.offsetWidth;
  658. if(window.event)
  659. {
  660. m.ob=event.srcElement;
  661. m.left=event.x+gsl();
  662. m.top=event.y+scrollTop;
  663. }
  664. else
  665. {
  666. event.preventDefault();
  667. m.ob=event.target;
  668. m.left=event.pageX;
  669. m.top=event.pageY;
  670. }
  671. m.ob.m=m;
  672. m.bottom=m.top+m.offsetHeight;
  673. if(m.bottom>scrollTop+getVH())
  674. {
  675. m.top-=((m.top+m.offsetHeight)-(scrollTop+getVH()));
  676. glut.BMM=m;
  677. }
  678. if(m.left+menuWidth>scrollLeft+gvw())
  679. {
  680. m.left-=((m.left+menuWidth)-(scrollLeft+gvw()));
  681. glut.RMM=m;
  682. }
  683. ump();
  684. m.style.left=m.left+"px";
  685. m.style.top=m.top+"px";
  686. if(bw.mIE)Doc.body.appendChild(Menu());
  687. m.style.visibility="visible";
  688. glut.am=m;
  689. return false;
  690. }
  691. function hm(event)
  692. {
  693. e=event?event:window.event;
  694. rt=e.toElement?e.toElement:e.relatedTarget;
  695. if(rt!=null)
  696. {
  697. if(ct(this,rt)||this.menubar&&this.menubar==rt)
  698. return;
  699. if(rt&&this.ob&&this.ob==rt||!bw.moz&&this.ob==rt.parentNode)
  700. return;
  701. if(this.om&&ct(this.om,rt))
  702. return;
  703. if(this.as&&ct(this.as,rt))
  704. {
  705. return;
  706. }
  707. }
  708. if(bw.moz)
  709. {
  710. if(this.as&&glut.c.y>getTop(this.as)-3&&glut.c.y<getTop(this.as)+this.as.offsetHeight+3)
  711. {
  712. if(this.as.iar)
  713. {
  714. if(glut.c.x+this.as.offsetWidth/2>this.as.offsetLeft)
  715. return;
  716. }
  717. else if(glut.c.x-this.as.offsetWidth/2<getOffset(this.as,"offsetLeft")+this.as.offsetWidth)
  718. return;
  719. }
  720. else if(this.om&&glut.c.y<this.om.offsetTop+this.om.offsetHeight)
  721. {
  722. if(this.iar)
  723. {
  724. if(glut.c.x>this.om.offsetLeft&&glut.c.x<this.om.offsetLeft+this.om.offsetWidth+20)return;
  725. }
  726. else if(glut.c.x>this.om.offsetLeft)return;
  727. }
  728. }
  729. if(bw.moz&&glut.c.y<glut.am.offsetTop+2)return;
  730. rsm(glut.am);
  731. if(glut.db)rs(glut.db,"buttons");
  732. else glut.mo=0;glut.am=null;
  733. this.isPos=0;
  734. return false;
  735. }
  736. if(bw.moz)
  737. {
  738. glut.c={x:0,y:0};
  739. document.addEventListener("mousemove",function(e){glut.c.x=e.pageX;glut.c.y=e.pageY;},false);}
  740. function no()
  741. {
  742. status=status;
  743. }
  744. function menuHideOnMouseOut(m)
  745. {
  746. m=getObj(m),
  747. m.onmouseout=hm;
  748. glut.mo=1;
  749. return false;
  750. }
  751. function keepOnTop()
  752. {
  753. glut.fb=1;
  754. if(this.style.top=="")
  755. this.style.top=typeof getTop(this)=="number"?getTop(this):this.offsetTop-1;
  756. if(bw.minNS61)this.style.position="fixed";
  757. else{viewTop=gst();
  758. viewBottom=getVH();
  759. if(getTop(this)+this.offsetHeight<viewTop)this.style.top=(viewTop-this.offsetHeight)+"px";
  760. if(this.top>viewBottom)this.style.top=viewBottom+"px";
  761. dy=Math.round(Math.abs(viewTop-getTop(this))/2);
  762. if(glut.db&&dy>0)rs(glut.db,"buttons");
  763. if(viewTop<getTop(this))dy=-dy;
  764. this.moveByY(dy);
  765. var sp=(getTop(this)!=viewTop)?54:400;
  766. if(sp==54&&bw.mIE){no();
  767. }
  768. setTimeout(this.id+".keepOnTop()",sp);
  769. }
  770. document.write("log");
  771. }
Once I run the project, it is showing the following error



"Microsoft JScript runtime error: 'srcElement' is null or not an object

Microsoft JScript runtime error: 'ol' is null or not an object"
Aug 6 '08 #1
3 8304
r035198x
13,262 8TB
Please use code tags when posting code.
Which line numbers are given. What have you checked and come up with so far?
Aug 6 '08 #2
kenobewan
4,871 Expert 4TB
This looks like far too much clientside code for my liking ;). Hopefully the JS experts will be able to help. I am moving...
Aug 6 '08 #3
gits
5,390 Expert Mod 4TB
yep ... with that unindented and huge piece of code it is just a pain to try to find anything ... when the IE error messages are confusing you may try it with Firefox and have a look at its error-console or even better install the firebug extension and then trace the error down to a more specific line ... may be firebug gives you better hints for what is going wrong too ...

kind regards
Aug 6 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Gregor Horvath | last post: by
1 post views Thread by JNariss | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.