Solved

Need to know how to pass values into a .JS file, probably just a simple syntax issue

Posted on 2008-10-30
10
351 Views
Last Modified: 2013-11-19
I've never used a .JS file before for javascript so I don't really know how to use the functions within it on the page.  I got this software called Vista Buttons to create menus and it makes a .JS file which has the proper include in the HTML for it.  It looks like they do it with a variable called vbImgPath but I cannot seem to do it the same way they do.  I will have multiple variables that I need to pass in from textboxes and stick in the URL of one of the menu options.  

Here is what is included in the HTML page:
<!-- Begin Vista-Buttons.com -->
<link href="Vista Menu-files/styles_3uqfs.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript"> var vbImgPath="Vista Menu-files/"</script>
<script type="text/javascript" src="Vista Menu-files/sc3uqfs.js"></script>
<noscript><a href="http://vista-buttons.com">Windows Xp Style Menu by Vista-Buttons.com v2.79</a></noscript>
<!-- End Vista-Buttons.com -->

Here is an excerpt from the .JS file.  It includes a working example of the variable they passed in called vbImgPath and one that I tried to pass in called Own.  I tried just copying the line that they use and sticking in Own=500000.  The link gets cut off in the browser at the point I try to add that variable to the link.
<img id="xpi_4uqfs" src="'+vbImgPath+'/bt4uqfs_0.gif" name="vb4uqfs" width="59" height="25" border="0" alt="Home"/></a></td></tr></table>');
document.write('<ul id="vbUL_ruqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner="'+Own+'"&User=NKress&SSUName=" title="Main Screen"

So essentially, I just need to build a link like this:
http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner=500000&User=JDoe 

I attached the .JS file.
document.write('<table id="vista-buttons.com:id3uqfs" width=0 cellpadding=0 cellspacing=0 border=0><tr><td style="padding-right:0px" title ="  Home  "><a onmouseover=\'xpe("3uqfso");\' onmouseout=\'xpe("3uqfsn");\'><img id="xpi_3uqfs" src="'+vbImgPath+'/bt3uqfs_0.gif" name="vb3uqfs" width="65" height="25" border="0" alt="  Home  "/></a></td><td style="padding-right:0px" title =" Name & Address"><a onmouseover=\'xpe("ruqfso");xpshow("ruqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_ruqfs" src="'+vbImgPath+'/btruqfs_0.gif" name="vbruqfs" width="126" height="25" border="0" alt=" Name & Address"/></a></td><td style="padding-right:0px" title =" Owner Interests"><a onmouseover=\'xpe("6uqfso");xpshow("6uqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_6uqfs" src="'+vbImgPath+'/bt6uqfs_0.gif" name="vb6uqfs" width="125" height="25" border="0" alt=" Owner Interests"/></a></td><td style="padding-right:0px" title =" A/R & Revenue"><a onmouseover=\'xpe("2uqfso");xpshow("2uqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_2uqfs" src="'+vbImgPath+'/bt2uqfs_0.gif" name="vb2uqfs" width="120" height="25" border="0" alt=" A/R & Revenue"/></a></td><td style="padding-right:0px" title =" Joint Interest Billing"><a onmouseover=\'xpe("tuqfso");xpshow("tuqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_tuqfs" src="'+vbImgPath+'/bttuqfs_0.gif" name="vbtuqfs" width="147" height="25" border="0" alt=" Joint Interest Billing"/></a></td><td style="padding-right:0px" title =" Accounts Payable"><a onmouseover=\'xpe("puqfso");xpshow("puqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_puqfs" src="'+vbImgPath+'/btpuqfs_0.gif" name="vbpuqfs" width="133" height="25" border="0" alt=" Accounts Payable"/></a></td><td style="padding-right:0px" title =" Revenue Suspense"><a onmouseover=\'xpe("ouqfso");xpshow("ouqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_ouqfs" src="'+vbImgPath+'/btouqfs_0.gif" name="vbouqfs" width="140" height="25" border="0" alt=" Revenue Suspense"/></a></td><td style="padding-right:0px" title =" Add Comments"><a onmouseover=\'xpe("wuqfso");xpshow("wuqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'><img id="xpi_wuqfs" src="'+vbImgPath+'/btwuqfs_0.gif" name="vbwuqfs" width="119" height="25" border="0" alt=" Add Comments"/></a></td><td style="padding-right:0px" title ="             "><a onmouseover=\'xpe("4uqfso");\' onmouseout=\'xpe("4uqfsn");\'><img id="xpi_4uqfs" src="'+vbImgPath+'/bt4uqfs_0.gif" name="vb4uqfs" width="59" height="25" border="0" alt="             "/></a></td></tr></table>');
document.write('<ul id="vbUL_ruqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner="'+Own+'"&User=NKress&SSUName=" title="Main Screen" target="main">Main&nbsp;Screen</a></li><li><a href="View.PgmName.value=\'NMARWI\';SubmitView(View);" title="Owner Detail">Owner&nbsp;Detail</a></li></ul><ul id="vbUL_6uqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Properties">Properties</a></li><li><a title="Transfers of Interest">Transfers&nbsp;of&nbsp;Interest</a></li><li><a title="Owner\'s Transfer Log">Owner\'s&nbsp;Transfer&nbsp;Log</a></li></ul><ul id="vbUL_2uqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Accts Receivable">Accts&nbsp;Receivable</a></li><li><a title="Revenue Payment History">Revenue&nbsp;Payment&nbsp;History</a></li><li><a title="Display Active Jobs">Display&nbsp;Active&nbsp;Jobs</a></li></ul><ul id="vbUL_tuqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="JIB History">JIB&nbsp;History</a></li></ul><ul id="vbUL_puqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="By Vendor">By&nbsp;Vendor</a></li></ul><ul id="vbUL_ouqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Suspense by Owner">Suspense&nbsp;by&nbsp;Owner</a></li><li><a title="Netted Suspense">Netted&nbsp;Suspense</a></li></ul><ul id="vbUL_wuqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Owner Portal Comments">Owner&nbsp;Portal&nbsp;Comments</a></li><li><a title="Mail Merge Owner Letters">Mail&nbsp;Merge&nbsp;Owner&nbsp;Letters</a></li></ul>');
vb3uqfsn=xppr('3uqfs_0.gif');vb3uqfso=xppr('3uqfs_1.gif');vbruqfsn=xppr('ruqfs_0.gif');vbruqfso=xppr('ruqfs_1.gif');vb6uqfsn=xppr('6uqfs_0.gif');vb6uqfso=xppr('6uqfs_1.gif');vb2uqfsn=xppr('2uqfs_0.gif');vb2uqfso=xppr('2uqfs_1.gif');vbtuqfsn=xppr('tuqfs_0.gif');vbtuqfso=xppr('tuqfs_1.gif');vbpuqfsn=xppr('puqfs_0.gif');vbpuqfso=xppr('puqfs_1.gif');vbouqfsn=xppr('ouqfs_0.gif');vbouqfso=xppr('ouqfs_1.gif');vbwuqfsn=xppr('wuqfs_0.gif');vbwuqfso=xppr('wuqfs_1.gif');vb4uqfsn=xppr('4uqfs_0.gif');vb4uqfso=xppr('4uqfs_1.gif');var arrowChar='&raquo;';var btIdPref='vb';function xppr(im){var i=new Image();i.src=vbImgPath+'bt'+im;return i;};function xpe(id){x=id.substring(0,id.length-1);if(document[btIdPref+x])document[btIdPref+x].src=eval(btIdPref+id+'.src');return false;};
var hideTimeout=300,menuContId='xpMenuCont',ulIdPref='vbUL_',imgIdPref='xpi_';function xpinit(){isDOM=document.getElementById;isOp=isO5=window.opera&&isDOM;isOp7=isOp&&document.readyState;isIE=document.all&&document.all.item&&!isOp;isNS4=document.layers;isMz=isDOM&&navigator.appName=="Netscape";document.write('<div id="'+menuContId+'" ></div>');var ULs=document.getElementsByTagName('UL');for(var i=0,cnt=ULs.length;i<cnt;i++)if(ULs[i].id&&(ULs[i].id.substring(0,ulIdPref.length)==ulIdPref)&&!((ULs[i].parentNode)&&(ULs[i].parentNode.parentNode)&&(ULs[i].parentNode.parentNode.id.substring(0,ulIdPref.length)==ulIdPref))){xpCreateMenu(ULs[i],0,0);};};xpinit();function xpObjectSize(o){var w=(isOp&&!isOp7)?o.style.pixelWidth:isNS4?o.clip.width:o.offsetWidth,h=(isOp&&!isOp7)?o.style.pixelHeight:isNS4?o.clip.height:o.offsetHeight;return{x:w,y:h};};function xpClientSize(){var x=0,y=0,w=0,h=0,doc=document,win=window,cond=(!doc.compatMode||doc.compatMode=='CSS1Compat')&&!win.opera&&doc.documentElement;if(cond&&doc.documentElement.clientHeight)h=doc.documentElement.clientHeight;else if(doc.body&&doc.body.clientHeight)h=doc.body.clientHeight;else if(xpDef(win.innerWidth,win.innerHeight,doc.width)){h=win.innerHeight;if(doc.width>win.innerWidth)h-=16;};if(cond&&doc.documentElement.clientWidth)w=doc.documentElement.clientWidth;else if(doc.body&&doc.body.clientWidth)w=doc.body.clientWidth;else if(xDef(win.innerWidth,win.innerHeight,doc.height)){w=win.innerWidth;if(doc.height>win.innerHeight)w-=16;};if(win.document.documentElement&&win.document.documentElement.scrollLeft)x=win.document.documentElement.scrollLeft;else if(win.document.body&&xpDef(win.document.body.scrollLeft))x=win.document.body.scrollLeft;if(win.document.documentElement&&win.document.documentElement.scrollTop)y=win.document.documentElement.scrollTop;else if(win.document.body&&xpDef(win.document.body.scrollTop))y=win.document.body.scrollTop;return{x:x,y:y,w:w,h:h};};function xpDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false;};return true;};function xppos(obj){var l=0,t=0;while(obj){l+=obj.offsetLeft;t+=obj.offsetTop;obj=obj.offsetParent;};if(document.body)with(document){if(body.leftMargin)l-=body.leftMargin;if(body.topMargin)t-=body.topMargin};return{x:l,y:t};};function xpCreateMenu(ulParent,iParent,level){var menuCont=document.getElementById(menuContId),oMenu=document.createElement('div');menuCont.appendChild(oMenu);var oTable=document.createElement('table');oMenu.appendChild(oTable);oMenu.id=ulParent.id+'tbl';oMenu.className=ulParent.className;oMenu.style.position='absolute';oMenu.iParent=iParent;oMenu.level=level;oMenu.style.zIndex=9+oMenu.level;oTable.cellSpacing=0;oMenu.onmouseover=function(){xpsmover(this)};oMenu.onmouseout=function(){xpsmout(this)};oMenu.ClearMenuMark=function(){for(var j=0;j<this.childNodes[0].rows.length;j++){p=this.childNodes[0].rows[j];if(p.tagName=='TR'){p.className=p.className.replace('over','');if(p.className.indexOf('popup')<0)p.clrOverImg();};};};oMenu.smShown=0;for(var i=0,cntLI=ulParent.childNodes.length;i<cntLI;i++){var oLI=ulParent.childNodes[i];if(oLI.tagName=='LI'){var oItem=oTable.insertRow(-1);oItem.menu=oMenu;oItem.setPopup=function(){this.className+=' popup';};oItem.clrPopup=function(){this.className=this.className.replace('popup','');if(this.className.indexOf('over')<0)this.clrOverImg();};oItem.clrOverImg=function(){if(this.Img)this.Img.style.display='inline';if(this.ImgOver)this.ImgOver.style.display='none';if(this.ImgArrow)this.ImgArrow.style.display='inline';if(this.ImgArrowOver)this.ImgArrowOver.style.display='none'};oItem.className=oLI.className;var InnerAnchor=0;oItem.Img=null;oItem.ImgOver=null;var InnerUl=0;oItem.ImgArrow=null;oItem.ImgArrowOver=null;for(var j=0;j<oLI.childNodes.length;j++)if(oLI.childNodes[j].tagName=='A')InnerAnchor=oLI.childNodes[j];else if(oLI.childNodes[j].tagName=='IMG'){if(!InnerAnchor){if(!oItem.Img)oItem.Img=oLI.childNodes[j];else oItem.ImgOver=oLI.childNodes[j]}else{if(!oItem.ImgArrow)oItem.ImgArrow=oLI.childNodes[j];else oItem.ImgArrowOver=oLI.childNodes[j]};}else if(oLI.childNodes[j].tagName=='UL')InnerUl=oLI.childNodes[j];if(InnerAnchor||InnerUl||oItem.ImgArrow){var oTDIMG=oItem.insertCell(-1),oTDLabel=oItem.insertCell(-1),oTDArrow=oItem.insertCell(-1);oTDIMG.style.borderRightWidth='0px';oTDLabel.style.borderRightWidth='0px';oTDLabel.style.borderLeftWidth='0px';oTDArrow.style.borderLeftWidth='0px';oTDIMG.style.paddingRight='4px';oTDLabel.style.paddingRight='4px';oTDLabel.style.paddingLeft='4px';oTDArrow.style.paddingLeft='4px';if(oItem.Img)oTDIMG.appendChild(oItem.Img);else oTDIMG.innerHTML='&nbsp;';if(oItem.ImgOver){oItem.ImgOver.style.display='none';oTDIMG.appendChild(oItem.ImgOver);};if(InnerAnchor){oTDLabel.appendChild(InnerAnchor);oItem.ItemLink=InnerAnchor;InnerAnchor.onclick=function(){return false;};oItem.onclick=function(){open(this.ItemLink.href,(this.ItemLink.target?this.ItemLink.target:"_self"));return true;};}else oTDLabel.innerHTML='&nbsp;';oItem.onmouseover=function(){this.menu.ClearMenuMark();this.className+=' over';if(this.ImgOver){this.Img.style.display='none';this.ImgOver.style.display='inline'};if(this.ImgArrowOver){this.ImgArrow.style.display='none';this.ImgArrowOver.style.display='inline'};if(this.smPopupId)xpshowmenu(this.smPopupId,1,this);else if(this.menu.smShown)xpStartTimeOut(this.menu.smShown);};oItem.onmouseout=function(){this.menu.ClearMenuMark();};if(InnerUl){oTDArrow.className='arrow';if(oItem.ImgArrow){oTDArrow.appendChild(oItem.ImgArrow);if(oItem.ImgArrowOver){oItem.ImgArrowOver.style.display='none';oTDArrow.appendChild(oItem.ImgArrowOver)}}else{if(typeof(arrowChar)!='undefined'&&arrowChar){oTDArrow.appendChild(document.createElement('a'));oTDArrow.lastChild.innerHTML=arrowChar;}else oTDArrow.innerHTML='&nbsp;';};oItem.smPopupId=xpCreateMenu(InnerUl,oItem,level+1);}else oTDArrow.innerHTML='&nbsp;';}else{var oTD=oItem.insertCell(-1);oTD.colSpan=3;oTD.innerHTML='<div></div>';};};};return oMenu.id;};function xpshow(ind,isVertical,iParent){xpshowmenu(ulIdPref+ind+'tbl',isVertical,iParent);};function xpshowmenu(menuID,isVertical,iParent){var menu=document.getElementById(menuID);if(!menu)return;if(menu.style.visibility=='visible'){xpStopTimeOut(menu);return;};if(iParent&&iParent.menu&&iParent.menu.smShown)xphide(iParent.menu.smShown.id);if(!menu.level&&(ShownMenu!=menu))xphide(ShownMenu.id);if(!menu.level)xobtn=menuID.replace(ulIdPref,'').replace('tbl','');var parentObj;if(iParent.tagName=='A'){parentObj=iParent.parentNode;}else parentObj=iParent;var pos=xppos(parentObj),size=xpObjectSize(parentObj);menu.goMenuX=1;menu.goMenuDx=1;if(menu.level>0){menu.goMenuX=menu.iParent.menu.goMenuX;menu.goMenuDx=menu.iParent.menu.goMenuDx;};menu.style.overflow='visible';menu.style.height='auto';menu.style.width='auto';menu.style.left='0px';menu.style.top='0px';var parentAbs=xppos(menu),WinSize=xpClientSize(),menuSize=xpObjectSize(menu),CalcedPos=xp_CalcMenuPos(WinSize.y,WinSize.h,pos.y,size.y,menuSize.y,menu.goMenuDx,isVertical);menu.goMenuDx=CalcedPos.align;if(isOp&&!menu.OrigWidth)menu.OrigWidth=menu.clientWidth;if(CalcedPos.size<menuSize.y){menu.style.overflow='auto';if(isIE)menu.style.overflowX='visible';if(isIE)menu.style.width=menu.offsetWidth+17+'px';else if(isMz)menu.style.magrinRight=20;menu.style.height=CalcedPos.size+'px';menu.scrollTop=0;menu.scrollLeft=0;if(isOp)menu.style.width=menu.OrigWidth+'px';}else{};menu.style.top=CalcedPos.xy-parentAbs.y+'px';menuSize=xpObjectSize(menu);CalcedPos=xp_CalcMenuPos(WinSize.x,WinSize.w,pos.x,size.x,menuSize.x,menu.goMenuX,!isVertical);menu.goMenuX=CalcedPos.align;if(CalcedPos.size<menuSize.x)if(menu.goMenuX>0)CalcedPos.xy-=(menuSize.x-CalcedPos.size);menu.style.left=CalcedPos.xy-parentAbs.x+'px';menu.style.visibility='visible';if(!menu.level)ShownMenu=menu;else{iParent.menu.smShown=menu;iParent.setPopup();};};function xp_CalcMenuPos(screenXY,screenSize,parentXY,parentSize,size,align,oHoriz){var xy=parentXY,newSize=size,newAlign=align,space=5;if((align==0)&&(!oHoriz))align=1;if(!oHoriz){if(((newAlign>=0)&&(parentXY+parentSize+size>screenSize+screenXY-space))||((newAlign<0)&&(parentXY-size<space))){if(parentXY-screenXY>screenSize+screenXY-(parentXY+parentSize))newAlign=-1;else newAlign=1;};if(newAlign>=0){xy=parentXY+parentSize;if(screenSize+screenXY-space-xy<newSize)newSize=screenSize+screenXY-space-xy;}else{xy=parentXY-newSize;if(xy-screenXY<space){xy=space+screenXY;newSize=parentXY-space-screenXY;};};}else{if(newSize>screenSize-2*space){xy=space+screenXY;newSize=screenSize-2*space;}else{xy=parentXY+parentSize/2-newSize/2+newAlign*(newSize/2-parentSize/2);if(xy<space+screenXY){newAlign=1;xy=space+screenXY;};if(xy+size>screenSize+screenXY-space){newAlign=-1;xy-=xy+newSize-(screenSize+screenXY-space);};};};return{xy:xy,size:newSize,align:newAlign};};function xphide(menuId){var menu=document.getElementById(menuId);if(!menu)return;if(menu.style.visibility=='visible'){if(menu.smShown)xphide(menu.smShown.id);menu.ClearMenuMark();menu.style.visibility='hidden';if(menu.level==0){xpe(xobtn+'n');};menu.smShown=0;if(menu.iParent)menu.iParent.clrPopup();if(menu.hideTimer){clearTimeout(menu.hideTimer);menu.hideTimer=null;};};};function xpsmout(sender){if(!sender)return;xpStartTimeOut(ShownMenu)};function xpsmover(menu){if(!menu)return;xpStopTimeOut(menu);};function xpStopTimeOut(menu){for(var o=menu;o;o=o.iParent?o.iParent.menu:0)if(o.hideTimer)o.hideTimer=clearTimeout(o.hideTimer);};function xpStartTimeOut(menu){for(var o=menu;o;o=o.smShown){var code='xphide("'+o.id+'");';if(!o.hideTimer&&o.id)o.hideTimer=setTimeout(code,hideTimeout);};};var ShownMenu=0,xobtn=null;
 
 
 
 
 
Here it is cleaned up:
document.write('')
			   
<table id="vista-buttons.com:id3uqfs" width=0 cellpadding=0 cellspacing=0 border=0><tr>
	<td style="padding-right:0px" title ="  Home  ">
		<a onmouseover=\'xpe("3uqfso");
		\' onmouseout=\'xpe("3uqfsn");\'>
		<img id="xpi_3uqfs" src="'+vbImgPath+'/bt3uqfs_0.gif" name="vb3uqfs" width="65" height="25" border="0" alt="  Home  "/></a></td>
	<td style="padding-right:0px" title =" Name & Address"><a onmouseover=\'xpe("ruqfso");xpshow("ruqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_ruqfs" src="'+vbImgPath+'/btruqfs_0.gif" name="vbruqfs" width="126" height="25" border="0" alt=" Name & Address"/></a></td>
	<td style="padding-right:0px" title =" Owner Interests"><a onmouseover=\'xpe("6uqfso");xpshow("6uqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_6uqfs" src="'+vbImgPath+'/bt6uqfs_0.gif" name="vb6uqfs" width="125" height="25" border="0" alt=" Owner Interests"/></a></td>
	<td style="padding-right:0px" title =" A/R & Revenue"><a onmouseover=\'xpe("2uqfso");xpshow("2uqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_2uqfs" src="'+vbImgPath+'/bt2uqfs_0.gif" name="vb2uqfs" width="120" height="25" border="0" alt=" A/R & Revenue"/></a></td>
	<td style="padding-right:0px" title =" Joint Interest Billing"><a onmouseover=\'xpe("tuqfso");xpshow("tuqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>		<img id="xpi_tuqfs" src="'+vbImgPath+'/bttuqfs_0.gif" name="vbtuqfs" width="147" height="25" border="0" alt=" Joint Interest Billing"/></a></td>
	<td style="padding-right:0px" title =" Accounts Payable"><a onmouseover=\'xpe("puqfso");xpshow("puqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_puqfs" src="'+vbImgPath+'/btpuqfs_0.gif" name="vbpuqfs" width="133" height="25" border="0" alt=" Accounts Payable"/></a></td>
	<td style="padding-right:0px" title =" Revenue Suspense"><a onmouseover=\'xpe("ouqfso");xpshow("ouqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_ouqfs" src="'+vbImgPath+'/btouqfs_0.gif" name="vbouqfs" width="140" height="25" border="0" alt=" Revenue Suspense"/></a></td>
	<td style="padding-right:0px" title =" Add Comments"><a onmouseover=\'xpe("wuqfso");xpshow("wuqfs",0,this);xpsmover(this);\' onmouseout=\'xpsmout(this);\'>
		<img id="xpi_wuqfs" src="'+vbImgPath+'/btwuqfs_0.gif" name="vbwuqfs" width="119" height="25" border="0" alt=" Add Comments"/></a></td>
	<td style="padding-right:0px" title ="             "><a onmouseover=\'xpe("4uqfso");\' onmouseout=\'xpe("4uqfsn");\'>
		<img id="xpi_4uqfs" src="'+vbImgPath+'/bt4uqfs_0.gif" name="vb4uqfs" width="59" height="25" border="0" alt="             "/></a></td></tr>
</table>
');
		
document.write('')
	<ul id="vbUL_ruqfs" class="vbUL3uqfs" style="visibility:hidden;">
		<li><a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner=500000&User=NKress&SSUName=" title="Main Screen" target="main">Main&nbsp;Screen</a></li>
		<li><a href="View.PgmName.value=\'NMARWI\';SubmitView(View);" title="Owner Detail">Owner&nbsp;Detail</a></li></ul>
	
	<ul id="vbUL_6uqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Properties">Properties</a></li>
		<li><a title="Transfers of Interest">Transfers&nbsp;of&nbsp;Interest</a></li>
		<li><a title="Owner\'s Transfer Log">Owner\'s&nbsp;Transfer&nbsp;Log</a></li></ul>
		
	<ul id="vbUL_2uqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Accts Receivable">Accts&nbsp;Receivable</a></li>
		<li><a title="Revenue Payment History">Revenue&nbsp;Payment&nbsp;History</a></li>
		<li><a title="Display Active Jobs">Display&nbsp;Active&nbsp;Jobs</a></li></ul>
	<ul id="vbUL_tuqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="JIB History">JIB&nbsp;History</a></li></ul>
	<ul id="vbUL_puqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="By Vendor">By&nbsp;Vendor</a></li></ul>
	<ul id="vbUL_ouqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Suspense by Owner">Suspense&nbsp;by&nbsp;Owner</a></li>
		<li><a title="Netted Suspense">Netted&nbsp;Suspense</a></li></ul>
	<ul id="vbUL_wuqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a title="Owner Portal Comments">Owner&nbsp;Portal&nbsp;Comments</a></li>
		<li><a title="Mail Merge Owner Letters">Mail&nbsp;Merge&nbsp;Owner&nbsp;Letters</a></li></ul>
');
 
vb3uqfsn=xppr('3uqfs_0.gif');
vb3uqfso=xppr('3uqfs_1.gif');
vbruqfsn=xppr('ruqfs_0.gif');
vbruqfso=xppr('ruqfs_1.gif');
vb6uqfsn=xppr('6uqfs_0.gif');
vb6uqfso=xppr('6uqfs_1.gif');
vb2uqfsn=xppr('2uqfs_0.gif');
vb2uqfso=xppr('2uqfs_1.gif');
vbtuqfsn=xppr('tuqfs_0.gif');
vbtuqfso=xppr('tuqfs_1.gif');
vbpuqfsn=xppr('puqfs_0.gif');
vbpuqfso=xppr('puqfs_1.gif');
vbouqfsn=xppr('ouqfs_0.gif');
vbouqfso=xppr('ouqfs_1.gif');
vbwuqfsn=xppr('wuqfs_0.gif');
vbwuqfso=xppr('wuqfs_1.gif');
vb4uqfsn=xppr('4uqfs_0.gif');
vb4uqfso=xppr('4uqfs_1.gif');
 
var arrowChar='&raquo;';
var btIdPref='vb';
 
function xppr(im)
{
	var i=new Image();i.src=vbImgPath+'bt'+im;
	return i;
};
 
function xpe(id)
{
	x=id.substring(0,id.length-1);if(document[btIdPref+x])document[btIdPref+x].src=eval(btIdPref+id+'.src');
	return false;
};
var hideTimeout=300,menuContId='xpMenuCont',ulIdPref='vbUL_',imgIdPref='xpi_';
 
function xpinit()
{
	isDOM=document.getElementById;isOp=isO5=window.opera&&isDOM;isOp7=isOp&&document.readyState;
	isIE=document.all&&document.all.item&&!isOp;isNS4=document.layers;
	isMz=isDOM&&navigator.appName=="Netscape";
	
document.write('
	<div id="'+menuContId+'" ></div>');
	var ULs=document.getElementsByTagName('UL');
		for(var i=0,cnt=ULs.length;i<cnt;i++)
			if(ULs[i].id&&(ULs[i].id.substring(0,ulIdPref.length)==ulIdPref)&&!((ULs[i].parentNode)&&(ULs[i].parentNode.parentNode)&&(ULs[i].parentNode.parentNode.id.											               substring(0,ulIdPref.length)==ulIdPref)))
			{
				xpCreateMenu(ULs[i],0,0);
			};
};
				xpinit();
 
function xpObjectSize(o)
{
	var w=(isOp&&!isOp7)?o.style.pixelWidth:isNS4?o.clip.width:o.offsetWidth,h=(isOp&&!isOp7)?o.style.pixelHeight:isNS4?o.clip.height:o.offsetHeight;
	return{x:w,y:h};
};
 
function xpClientSize()
	{
		var x=0,y=0,w=0,h=0,doc=document,win=window,cond=(!doc.compatMode||doc.compatMode=='CSS1Compat')&&!win.opera&&doc.documentElement;
		if(cond&&doc.documentElement.clientHeight)h=doc.documentElement.clientHeight;
		else if(doc.body&&doc.body.clientHeight)h=doc.body.clientHeight;
		else if(xpDef(win.innerWidth,win.innerHeight,doc.width))
		{
		h=win.innerHeight;
		if(doc.width>win.innerWidth)h-=16;
		};
			if(cond&&doc.documentElement.clientWidth)w=doc.documentElement.clientWidth;
			else if(doc.body&&doc.body.clientWidth)w=doc.body.clientWidth;
			else if(xDef(win.innerWidth,win.innerHeight,doc.height))
			{
				w=win.innerWidth;
				if(doc.height>win.innerHeight)w-=16;
	};
		if(win.document.documentElement&&win.document.documentElement.scrollLeft)x=win.document.documentElement.scrollLeft;
		else if(win.document.body&&xpDef(win.document.body.scrollLeft))x=win.document.body.scrollLeft;
		if(win.document.documentElement&&win.document.documentElement.scrollTop)y=win.document.documentElement.scrollTop;
		else if(win.document.body&&xpDef(win.document.body.scrollTop))y=win.document.body.scrollTop;
		return{x:x,y:y,w:w,h:h};
	};
 
function xpDef()
	{
		for(var i=0;i<arguments.length;++i)
		{
			if(typeof(arguments[i])=='undefined')
				return false;
		};
				return true;
	};
 
function xppos(obj)
{
	var l=0,t=0;
	while(obj)
	{
		l+=obj.offsetLeft;t+=obj.offsetTop;obj=obj.offsetParent;
	};
		if(document.body)
		with(document)
		{
			if(body.leftMargin)l-=body.leftMargin;
				if(body.topMargin)t-=body.topMargin
				};
				return{x:l,y:t};
};
				
function xpCreateMenu(ulParent,iParent,level)
{
	var menuCont=document.getElementById(menuContId),oMenu=document.createElement('div');menuCont.appendChild(oMenu);
	var oTable=document.createElement('table');oMenu.appendChild(oTable);oMenu.id=ulParent.id+'tbl';oMenu.className=ulParent.className;oMenu.style.position='absolute';	        oMenu.iParent=iParent;oMenu.level=level;oMenu.style.zIndex=9+oMenu.level;
		oTable.cellSpacing=0;oMenu.onmouseover=function()
	{xpsmover(this)};oMenu.onmouseout=function()
	{xpsmout(this)};oMenu.ClearMenuMark=function()
	{
		for(var j=0;j<this.childNodes[0].rows.length;j++)
		{	p=this.childNodes[0].rows[j];
				if(p.tagName=='TR'){p.className=p.className.replace('over','');
				if(p.className.indexOf('popup')<0)p.clrOverImg();};};};
				oMenu.smShown=0;
		for(var i=0,cntLI=ulParent.childNodes.length;i<cntLI;i++)
		{
			var oLI=ulParent.childNodes[i];
			if(oLI.tagName=='LI')
			{
				var oItem=oTable.insertRow(-1);oItem.menu=oMenu;oItem.setPopup=function()
				{this.className+=' popup';};oItem.clrPopup=function()
				{this.className=this.className.replace('popup','');
				
					if(this.className.indexOf('over')<0)this.clrOverImg();};oItem.clrOverImg=function(){
						if(this.Img)this.Img.style.display='inline';
							if(this.ImgOver)this.ImgOver.style.display='none';
								if(this.ImgArrow)this.ImgArrow.style.display='inline';
									if(this.ImgArrowOver)this.ImgArrowOver.style.display='none'};oItem.className=oLI.className;
										var InnerAnchor=0;oItem.Img=null;oItem.ImgOver=null;
										var InnerUl=0;oItem.ImgArrow=null;oItem.ImgArrowOver=null;
											for(var j=0;j<oLI.childNodes.length;j++)
												if(oLI.childNodes[j].tagName=='A')InnerAnchor=oLI.childNodes[j];
												else if(oLI.childNodes[j].tagName=='IMG')
												{
													if(!InnerAnchor)
													{
														if(!oItem.Img)oItem.Img=oLI.childNodes[j];
														else oItem.ImgOver=oLI.childNodes[j]
														}
														else
														{
															if(!oItem.ImgArrow)oItem.ImgArrow=oLI.childNodes[j];
															else oItem.ImgArrowOver=oLI.childNodes[j]};
															}
															else if(oLI.childNodes[j].tagName=='UL')InnerUl=oLI.childNodes[j];
															if(InnerAnchor||InnerUl||oItem.ImgArrow)
															{
																var oTDIMG=oItem.insertCell(-1),oTDLabel=oItem.insertCell(-1),oTDArrow=oItem.insertCell(-1);
																oTDIMG.style.borderRightWidth='0px';
																oTDLabel.style.borderRightWidth='0px';
																oTDLabel.style.borderLeftWidth='0px';
																oTDArrow.style.borderLeftWidth='0px';
																oTDIMG.style.paddingRight='4px';
																oTDLabel.style.paddingRight='4px';
																oTDLabel.style.paddingLeft='4px';
																oTDArrow.style.paddingLeft='4px';
																	
								if(oItem.Img)oTDIMG.appendChild(oItem.Img);
								else oTDIMG.innerHTML='&nbsp;';
								if(oItem.ImgOver){oItem.ImgOver.style.display='none';oTDIMG.appendChild(oItem.ImgOver);};
								if(InnerAnchor){oTDLabel.appendChild(InnerAnchor);oItem.ItemLink=InnerAnchor;InnerAnchor.onclick=function()
								{
									return false;
								};
					oItem.onclick=function(){
						open(this.ItemLink.href,(this.ItemLink.target?this.ItemLink.target:"_self"));
						return true;
						};
						}
						else oTDLabel.innerHTML='&nbsp;';oItem.onmouseover=function(){this.menu.ClearMenuMark();
						this.className+=' over';
						if(this.ImgOver){this.Img.style.display='none';
						this.ImgOver.style.display='inline'};
						if(this.ImgArrowOver){this.ImgArrow.style.display='none';this.ImgArrowOver.style.display='inline'};
						if(this.smPopupId)xpshowmenu(this.smPopupId,1,this);
						else if(this.menu.smShown)xpStartTimeOut(this.menu.smShown);};oItem.onmouseout=function(){this.menu.ClearMenuMark();};
						if(InnerUl){oTDArrow.className='arrow';
						if(oItem.ImgArrow){oTDArrow.appendChild(oItem.ImgArrow);
						if(oItem.ImgArrowOver){oItem.ImgArrowOver.style.display='none';oTDArrow.appendChild(oItem.ImgArrowOver)
						}
						}
						else
						{
							if(typeof(arrowChar)!='undefined'&&arrowChar){oTDArrow.appendChild(document.createElement('a'));oTDArrow.lastChild.innerHTML=arrowChar;
							}
							else oTDArrow.innerHTML='&nbsp;';
							};
							oItem.smPopupId=xpCreateMenu(InnerUl,oItem,level+1);
							}
							else oTDArrow.innerHTML='&nbsp;';
							}
							else
							{
								var oTD=oItem.insertCell(-1);oTD.colSpan=3;oTD.innerHTML='<div></div>';};};};
							return oMenu.id;
							};
 
function xpshow(ind,isVertical,iParent)
{
	xpshowmenu(ulIdPref+ind+'tbl',isVertical,iParent);
};
	
function xpshowmenu(menuID,isVertical,iParent)
{
	var menu=document.getElementById(menuID);
	if(!menu)return;
	if(menu.style.visibility=='visible')
	{
		xpStopTimeOut(menu);
	return;
	};
	if(iParent&&iParent.menu&&iParent.menu.smShown)xphide(iParent.menu.smShown.id);
	if(!menu.level&&(ShownMenu!=menu))xphide(ShownMenu.id);
	if(!menu.level)xobtn=menuID.replace(ulIdPref,'').replace('tbl','');
		var parentObj;if(iParent.tagName=='A'){parentObj=iParent.parentNode;
	}
	else parentObj=iParent;var pos=xppos(parentObj),size=xpObjectSize(parentObj);menu.goMenuX=1;menu.goMenuDx=1;
	if(menu.level>0){menu.goMenuX=menu.iParent.menu.goMenuX;menu.goMenuDx=menu.iParent.menu.goMenuDx;
	};
	menu.style.overflow='visible';menu.style.height='auto';menu.style.width='auto';menu.style.left='0px';menu.style.top='0px';
	var parentAbs=xppos(menu),WinSize=xpClientSize(),menuSize=xpObjectSize(menu),CalcedPos=xp_CalcMenuPos(WinSize.y,WinSize.h,pos.y,size.y,menuSize.y,menu.goMenuDx,isVertical);menu.goMenuDx=CalcedPos.align;
	if(isOp&&!menu.OrigWidth)menu.OrigWidth=menu.clientWidth;
	if(CalcedPos.size<menuSize.y){menu.style.overflow='auto';
	if(isIE)menu.style.overflowX='visible';
	if(isIE)menu.style.width=menu.offsetWidth+17+'px';
	else if(isMz)menu.style.magrinRight=20;menu.style.height=CalcedPos.size+'px';menu.scrollTop=0;menu.scrollLeft=0;
	if(isOp)menu.style.width=menu.OrigWidth+'px';}
	else{};
	menu.style.top=CalcedPos.xy-parentAbs.y+'px';
	menuSize=xpObjectSize(menu);
	CalcedPos=xp_CalcMenuPos(WinSize.x,WinSize.w,pos.x,size.x,menuSize.x,menu.goMenuX,!isVertical);
	menu.goMenuX=CalcedPos.align;
	if(CalcedPos.size<menuSize.x)
	if(menu.goMenuX>0)CalcedPos.xy-=(menuSize.x-CalcedPos.size);
		menu.style.left=CalcedPos.xy-parentAbs.x+'px';
		menu.style.visibility='visible';
	if(!menu.level)ShownMenu=menu;
	else{iParent.menu.smShown=menu;iParent.setPopup();};
	};
function xp_CalcMenuPos(screenXY,screenSize,parentXY,parentSize,size,align,oHoriz)
{
	var xy=parentXY,newSize=size,newAlign=align,space=5;
	if((align==0)&&(!oHoriz))align=1;
	if(!oHoriz)
	{
		if(((newAlign>=0)&&(parentXY+parentSize+size>screenSize+screenXY-space))||((newAlign<0)&&(parentXY-size<space)))
		{
			if(parentXY-screenXY>screenSize+screenXY-(parentXY+parentSize))newAlign=-1;
			else newAlign=1;
		};
			if(newAlign>=0)
			{
				xy=parentXY+parentSize;
				if(screenSize+screenXY-space-xy<newSize)newSize=screenSize+screenXY-space-xy;
			}
				else
				{
					xy=parentXY-newSize;
					if(xy-screenXY<space){xy=space+screenXY;newSize=parentXY-space-screenXY;
		};
		};
					}
				else{
					if(newSize>screenSize-2*space){xy=space+screenXY;newSize=screenSize-2*space;
					}
					else{
						xy=parentXY+parentSize/2-newSize/2+newAlign*(newSize/2-parentSize/2);
					if(xy<space+screenXY){newAlign=1;xy=space+screenXY;
					};
					if(xy+size>screenSize+screenXY-space)
					{
						newAlign=-1;xy-=xy+newSize-(screenSize+screenXY-space);
					};
						};
					};
					return{xy:xy,size:newSize,align:newAlign
					};
};
 
function xphide(menuId)
{
	var menu=document.getElementById(menuId);
	if(!menu)return;
		if(menu.style.visibility=='visible')
		{
			if(menu.smShown)xphide(menu.smShown.id);
				menu.ClearMenuMark();
				menu.style.visibility='hidden';
			if(menu.level==0)
			{
				xpe(xobtn+'n');
			};
			menu.smShown=0;
			if(menu.iParent)menu.iParent.clrPopup();
			if(menu.hideTimer){clearTimeout(menu.hideTimer);menu.hideTimer=null;
		};
	};
};
		
function xpsmout(sender)
{
	if(!sender)return;xpStartTimeOut(ShownMenu)
};
	
function xpsmover(menu)
{
	if(!menu)return;xpStopTimeOut(menu);
};
	
function xpStopTimeOut(menu)
{
	for(var o=menu;o;o=o.iParent?o.iParent.menu:0)
	if(o.hideTimer)o.hideTimer=clearTimeout(o.hideTimer);
};
 
function xpStartTimeOut(menu)
{
	for(var o=menu;o;o=o.smShown)
	{
		var code='xphide("'+o.id+'");';
		if(!o.hideTimer&&o.id)o.hideTimer=setTimeout(code,hideTimeout);
	};
};
var ShownMenu=0,xobtn=null;

Open in new window

0
Comment
Question by:bobjoest
  • 5
  • 5
10 Comments
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22840700
assuming you have in your link in browser:

"http://sometest.com/test.php?param1=3423¶m23=3553


this function will parse all of your parameters:


var table=location.search.replace(/^\?/,"").split("&");
var params=new Array();
for (var i=0,y=table.length;i<y;i++) params[i]=table[i].split("=");

Is that what you need?
0
 

Author Comment

by:bobjoest
ID: 22841181
Not really, it's more a matter of needing to pass values from the page to the .JS file.  When I declare a variable on the page and try to display it within the .JS file somewhere it comes up with an undeclared error.
0
 
LVL 18

Accepted Solution

by:
Pawel Witkowski earned 500 total points
ID: 22841527
I still dont have idea what are you all talking about but I will help you as far as I understand you:

in line:

<a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner="'+Own+'"&User=NKress&SSUName=" title="Main Screen"


the problem is after Owner="'    

because here you have  "  and '     that means - > closing  href link then adding a parameter so it will look like this:

<a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner="YourParameterHere

So you need this:

document.write('<ul id="vbUL_ruqfs" class="vbUL3uqfs" style="visibility:hidden;"><li><a href="http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner='+Own+'&User=NKress&SSUName=" title="Main Screen"
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:bobjoest
ID: 22841740
I tried that before and just now again.  Should I have to make a statement like below to use a variable declared in the page in that jscript file?  
<script type="text/javascript"> var Own=511111</script>
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22841785
yes, but to retrieve this value from adress just use function that i gave you, so:
<script type="text/javascript">

var table=location.search.replace(/^\?/,"").split("&");
var params=new Array();
for (var i=0,y=table.length;i<y;i++)
{
   var temp=table[i].split("=");
params[temp[0]]=temp[1];
}

</script>

so now you can type:

<script type="text/javascript"> var Own=params('Owner');</script>
0
 

Author Comment

by:bobjoest
ID: 22841857
I should have been more clear.  I tried that and it still didn't work.  The issue still remains that the link still shows up as:
http://a10b3131/cgi-bin/sysroi?PgmName=NMARWI&Owner=
and cuts off the rest.  Is there a way to check my temp files to see what was actually written for the .JS file?
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22842125
first of all... its very bad (very very) to use document.write ... but lets forget about it. First check that your value is filled with something, you can do that by:
alert(Own);
do that outside of document.write and we will see (maybe) whats the problem uhh
0
 

Author Comment

by:bobjoest
ID: 22843709
OK, I got all that sorted out and was able to pass it in.  I was using the wrong version of the JS file.  Why is it so bad to use document.write?  It was auto-generated by that menu creator software I used.  What would I need to do to just embed it in the html?
0
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22846275
A short concept here:

http://www.sitepoint.com/blogs/2007/07/11/insert-in-place-without-documentwrite/

normally script from .js files you put like this:

<script type="text/javascript" src="somesrc.js"></script>

And inside .js file you have normal javascript like:

// Begin

var element=4;
alert(element);

// End

Of course some older libaries may consist document.write but they generally ... well... sux ^^ as you can see there is problem with dynamical access and change of inserted nodes because they are parsed like text... That sux completly... I understand that your skill in javascript are very little, so I advice you to read something about DOM and javscript (mozilla got nice functions explanation). Javascript is very simple and flexible language, just try to understand some basics and rest will be easy... i think :)
0
 

Author Closing Comment

by:bobjoest
ID: 31511634
Sweet, thanks dude.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question