Ok, that's what I get from diving into a topic on the 2nd page
I thought you wanted just to have the contextitem popup the window and have it show the same URL but in dbug...which you already managed I read...
but to be on the safe side, here's a version that uses substring
<SCRIPT defer>
var loc = external.menuArguments.location;
open("http://dbug.."+loc.href.substring(7));
</SCRIPT>
there's only one thing...haven't been able to get this working AND insert the prefix variable without IE thinking it's some escaped code and destroying the url...same for the popup version...
Now this is a very crude popup, did not go as far as to make it close the popup if clicked outside it...
To fake a submenu by producing a popup does hide contextmenu after popup appears though...hope this survives the posting, I have intentionally not wrapped any lines and each statement ends in a semicolon, so if wrapping seems to occur, just unwrap so each statement is on a single line and it will be ok I hope.
Put the script into a html file (no need to add page body or tags...just copy paste the below...assuming you have set up a regkey already, just modify that key to point to the correct file.
<script defer>
var parentwin = external.menuArguments;
var d = parentwin.document;
var baseref = window.location.href;
baseref = baseref.substring(0,baseref.lastIndexOf("/")+1);
// utility functions to retrieve clickposition
function getX(e) { return e.x + d.body.scrollLeft; }
function getY(e) { return e.y + d.body.scrollTop; }
// the popup gets embedded into the DOM of the current active page.
// consequently, it only has to be created once...and hidden after use
if(!d.getElementById('scrollmenu'))
{
var menuItems = new Array(
new Array("javascript:open('http://dbug..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Debug"),
new Array("javascript:open('http://src..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Source"),
new Array("javascript:open('http://bweb..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Bypass Web"),
new Array("javascript:open('http://bin..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Bypass Hdr In"),
new Array("javascript:open('http://bout..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Bypass Hdr Out"),
new Array("javascript:open('http://bypass..'+document.location.href.substring(7));document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Bypass All"),
new Array("javascript:document.getElementById('scrollmenu').style.visibility='hidden';void(0);","Cancel")
);
d.createStyleSheet(baseref +"menu.css");
var span = "<span id="scrollmenu" onclick2="this.style.visibility='hidden'" class=PRX "+"style=""+"top:"+ getY(parentwin.event,d) +";"+"left:"+ getX(parentwin.event,d) +";"+"">";
for (i=0;i<menuItems.length;i++)
{
var item = menuItems;
if (item[0] != "")
span += "<div class=PRX onmouseover="this.className='PRX-mouseover';" onmouseout="this.className='PRX';"><a href=""+ item[0] +"" class=PRX>"+ item[1] +"</a></div>";
else
span += "<div align=center>"+ item[1] +"</div>";
}
span += "</span>";
d.body.insertAdjacentHTML("BeforeEnd",span);
}
d.getElementById('scrollmenu').style.top = getY(parentwin.event,d);
d.getElementById('scrollmenu').style.left = getX(parentwin.event,d);
d.getElementById('scrollmenu').style.visibility='visible';
</script>
As you can see in the code, there is also a stylesheet embedded into the current page's DOM, so you have an easier way to modify the look of the popup and bring it more into line with your current menu colors...copy paste the below and save to a file named menu.css and place it in same folder as above htmlfile
DIV.PRX
{
border-top : 1px solid #666666;
border-bottom : 1px solid #FFFFF0;
width : 100%;
padding : 2 1 2 1;
background-color : Gainsboro;
}
DIV.PRX-mouseover
{
border-top : 1px solid white;
border-bottom : 1px solid white;
width : 100%;
background-color: white;
color: black;
padding : 2 1 2 1;
}
SPAN.PRX
{
color: black;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 12px;
font-weight : bold;
border: 1px outset;
position:absolute;
visibility: visible;
background-color:white;
padding: 0 0 0 0;
width: 150px;
}
HTH
JarC
Edited by - TEggHead on 14 Jun 2002 14:54:44