I copied this code from a MS website and it creates a nice right click menu;
question: how can I alter the code in the line that reads: <SPAN
ONCLICK="TestThis">Call VBScript</SPAN> to actually call a VBScript sub?

The VBScript is between <Script> tags that preceed this code:

<BODY oncontextmenu="contextMenu(); return false;">
<h1>Creating Custom Context Menus with the Popup Object</h1>
Right-click anywhere on the document to see a customized popup navigation
menu.
<DIV ID="oContextHTML" STYLE="display:none;">
<DIV onmouseover="this.style.background='gold'"
onmouseout="this.style.background='#e4e4e4'"
<SPAN ONCLICK="TestThis">Call VBScript</SPAN>
</DIV>
</DIV>
</BODY>

Your help would be much appreciated...

RE: Right click menu to call VBScript by Irfan

Irfan
Thu May 10 04:35:01 CDT 2007

<script type="text/vbscript">

Sub TestThis()
msgbox "You clicked on Call VBScript"
End Sub

</script>

<BODY>
<SPAN onclick="TestThis"><p>Call VBScript</p></SPAN>
</BODY>

--------------------------------
is this what you want?



"XP" wrote:

> I copied this code from a MS website and it creates a nice right click menu;
> question: how can I alter the code in the line that reads: <SPAN
> ONCLICK="TestThis">Call VBScript</SPAN> to actually call a VBScript sub?
>
> The VBScript is between <Script> tags that preceed this code:
>
> <BODY oncontextmenu="contextMenu(); return false;">
> <h1>Creating Custom Context Menus with the Popup Object</h1>
> Right-click anywhere on the document to see a customized popup navigation
> menu.
> <DIV ID="oContextHTML" STYLE="display:none;">
> <DIV onmouseover="this.style.background='gold'"
> onmouseout="this.style.background='#e4e4e4'"
> <SPAN ONCLICK="TestThis">Call VBScript</SPAN>
> </DIV>
> </DIV>
> </BODY>
>
> Your help would be much appreciated...

RE: Right click menu to call VBScript by XP

XP
Thu May 10 07:24:01 CDT 2007


Well, that's the way I thought it should work, but when I click the menu
item, nothing happens...any ideas?

I could post the entire thing if it would help...

"Irfan" wrote:

> <script type="text/vbscript">
>
> Sub TestThis()
> msgbox "You clicked on Call VBScript"
> End Sub
>
> </script>
>
> <BODY>
> <SPAN onclick="TestThis"><p>Call VBScript</p></SPAN>
> </BODY>
>
> --------------------------------
> is this what you want?
>
>
>
> "XP" wrote:
>
> > I copied this code from a MS website and it creates a nice right click menu;
> > question: how can I alter the code in the line that reads: <SPAN
> > ONCLICK="TestThis">Call VBScript</SPAN> to actually call a VBScript sub?
> >
> > The VBScript is between <Script> tags that preceed this code:
> >
> > <BODY oncontextmenu="contextMenu(); return false;">
> > <h1>Creating Custom Context Menus with the Popup Object</h1>
> > Right-click anywhere on the document to see a customized popup navigation
> > menu.
> > <DIV ID="oContextHTML" STYLE="display:none;">
> > <DIV onmouseover="this.style.background='gold'"
> > onmouseout="this.style.background='#e4e4e4'"
> > <SPAN ONCLICK="TestThis">Call VBScript</SPAN>
> > </DIV>
> > </DIV>
> > </BODY>
> >
> > Your help would be much appreciated...

RE: Right click menu to call VBScript by Irfan

Irfan
Thu May 10 07:38:01 CDT 2007

Please can you post the entire thing ... will make it easier for me..

thanks,

"XP" wrote:

>
> Well, that's the way I thought it should work, but when I click the menu
> item, nothing happens...any ideas?
>
> I could post the entire thing if it would help...
>
> "Irfan" wrote:
>
> > <script type="text/vbscript">
> >
> > Sub TestThis()
> > msgbox "You clicked on Call VBScript"
> > End Sub
> >
> > </script>
> >
> > <BODY>
> > <SPAN onclick="TestThis"><p>Call VBScript</p></SPAN>
> > </BODY>
> >
> > --------------------------------
> > is this what you want?
> >
> >
> >
> > "XP" wrote:
> >
> > > I copied this code from a MS website and it creates a nice right click menu;
> > > question: how can I alter the code in the line that reads: <SPAN
> > > ONCLICK="TestThis">Call VBScript</SPAN> to actually call a VBScript sub?
> > >
> > > The VBScript is between <Script> tags that preceed this code:
> > >
> > > <BODY oncontextmenu="contextMenu(); return false;">
> > > <h1>Creating Custom Context Menus with the Popup Object</h1>
> > > Right-click anywhere on the document to see a customized popup navigation
> > > menu.
> > > <DIV ID="oContextHTML" STYLE="display:none;">
> > > <DIV onmouseover="this.style.background='gold'"
> > > onmouseout="this.style.background='#e4e4e4'"
> > > <SPAN ONCLICK="TestThis">Call VBScript</SPAN>
> > > </DIV>
> > > </DIV>
> > > </BODY>
> > >
> > > Your help would be much appreciated...

RE: Right click menu to call VBScript by XP

XP
Thu May 10 08:42:01 CDT 2007

Hi Irfan,

Here is the code; please help if you can and thanks:

<HTML>
<HEAD>
<TITLE>Popup Custom Navigation Menu Sample</TITLE>

<SCRIPT LANGUAGE="JScript">
var oPopup = window.createPopup();
function contextMenu()
{
// The variables "lefter" and "topper" store the X and Y coordinates
// to use as parameter values for the following show method. In this
// way, the popup displays near the location the user clicks.
var lefter = event.offsetX+10;
var topper = event.offsetY+10;
oPopup.document.body.innerHTML = oContextHTML.innerHTML;
oPopup.show(lefter, topper, 200, 65, document.body);
}

</SCRIPT>

<Script Language="VBScript">

Sub ChoiceOne
Msgbox "1st Item Clicked"
End Sub

Sub ChoiceTwo
MsgBox "2nd Item Clicked"
End Sub

</SCRIPT>
</HEAD>

<BODY oncontextmenu="contextMenu(); return false;">
<h1>Creating Custom Context Menus with the Popup Object</h1>
Right-click anywhere on the document to see a customized popup navigation
menu.

<DIV ID="oContextHTML" STYLE="display:none;">
<DIV onmouseover="this.style.background='gold';"
onmouseout="this.style.background='#e4e4e4';">
<SPAN onclick="ChoiceOne">Menu Item One</SPAN>
</DIV>
<DIV onmouseover="this.style.background='gold';"
onmouseout="this.style.background='#e4e4e4';">
<SPAN onclick="{ChoiceTwo}">Menu Item Two</SPAN>
</DIV>
</DIV>

</BODY>
</HTML>

********END CODE***********

"Irfan" wrote:

> Please can you post the entire thing ... will make it easier for me..
>
> thanks,
>
> "XP" wrote:
>
> >
> > Well, that's the way I thought it should work, but when I click the menu
> > item, nothing happens...any ideas?
> >
> > I could post the entire thing if it would help...
> >
> > "Irfan" wrote:
> >
> > > <script type="text/vbscript">
> > >
> > > Sub TestThis()
> > > msgbox "You clicked on Call VBScript"
> > > End Sub
> > >
> > > </script>
> > >
> > > <BODY>
> > > <SPAN onclick="TestThis"><p>Call VBScript</p></SPAN>
> > > </BODY>
> > >
> > > --------------------------------
> > > is this what you want?
> > >
> > >
> > >
> > > "XP" wrote:
> > >
> > > > I copied this code from a MS website and it creates a nice right click menu;
> > > > question: how can I alter the code in the line that reads: <SPAN
> > > > ONCLICK="TestThis">Call VBScript</SPAN> to actually call a VBScript sub?
> > > >
> > > > The VBScript is between <Script> tags that preceed this code:
> > > >
> > > > <BODY oncontextmenu="contextMenu(); return false;">
> > > > <h1>Creating Custom Context Menus with the Popup Object</h1>
> > > > Right-click anywhere on the document to see a customized popup navigation
> > > > menu.
> > > > <DIV ID="oContextHTML" STYLE="display:none;">
> > > > <DIV onmouseover="this.style.background='gold'"
> > > > onmouseout="this.style.background='#e4e4e4'"
> > > > <SPAN ONCLICK="TestThis">Call VBScript</SPAN>
> > > > </DIV>
> > > > </DIV>
> > > > </BODY>
> > > >
> > > > Your help would be much appreciated...

Re: Right click menu to call VBScript by Ayush

Ayush
Thu May 10 10:10:43 CDT 2007

[XP]s message :
> Hi Irfan,
>
> Here is the code; please help if you can and thanks:
...

Try this:

<HTML>
<HEAD>
<TITLE>Popup Custom Navigation Menu Sample</TITLE>

<SCRIPT LANGUAGE="vbscript">
Set oPopup = window.createPopup
Function contextMenu

lefter = window.event.offsetX+10
topper = window.event.offsetY+10
oPopup.document.body.innerHTML = oContextHTML.innerHTML
oPopup.show lefter, topper, 200, 65, window.document.body
window.event.returnValue=false
End Function

</SCRIPT>

</HEAD>
<BODY oncontextmenu="contextMenu">
<h1>Creating Custom Context Menus with the Popup Object</h1>
Right-click anywhere on the document to see a customized popup navigation
menu.

<DIV ID="oContextHTML" STYLE="display:none;">
<DIV onmouseover=this.style.background="gold"
onmouseout=this.style.background="#e4e4e4">
<SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>
</DIV>
<DIV onmouseover=this.style.background="gold"
onmouseout=this.style.background="#e4e4e4">
<SPAN onclick=msgbox("yyy") language="vbscript">Menu Item Two</SPAN>
</DIV>
</DIV>

</BODY>
</HTML>

Good Luck, Ayush.
--
Windows XP: http://www.microsoft.com/windows/using/windowsxp/default.mspx

Re: Right click menu to call VBScript by XP

XP
Thu May 10 11:51:02 CDT 2007

Ayush!!! Perfection and a thing of beauty...thanks again!

"Ayush" <"ayushmaan.j[aatt]gmail.com" wrote:

> [XP]s message :
> > Hi Irfan,
> >
> > Here is the code; please help if you can and thanks:
> ....
>
> Try this:
>
> <HTML>
> <HEAD>
> <TITLE>Popup Custom Navigation Menu Sample</TITLE>
>
> <SCRIPT LANGUAGE="vbscript">
> Set oPopup = window.createPopup
> Function contextMenu
>
> lefter = window.event.offsetX+10
> topper = window.event.offsetY+10
> oPopup.document.body.innerHTML = oContextHTML.innerHTML
> oPopup.show lefter, topper, 200, 65, window.document.body
> window.event.returnValue=false
> End Function
>
> </SCRIPT>
>
> </HEAD>
> <BODY oncontextmenu="contextMenu">
> <h1>Creating Custom Context Menus with the Popup Object</h1>
> Right-click anywhere on the document to see a customized popup navigation
> menu.
>
> <DIV ID="oContextHTML" STYLE="display:none;">
> <DIV onmouseover=this.style.background="gold"
> onmouseout=this.style.background="#e4e4e4">
> <SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>
> </DIV>
> <DIV onmouseover=this.style.background="gold"
> onmouseout=this.style.background="#e4e4e4">
> <SPAN onclick=msgbox("yyy") language="vbscript">Menu Item Two</SPAN>
> </DIV>
> </DIV>
>
> </BODY>
> </HTML>
>
> Good Luck, Ayush.
> --
> Windows XP: http://www.microsoft.com/windows/using/windowsxp/default.mspx
>

Re: Right click menu to call VBScript by XP

XP
Thu May 10 11:55:03 CDT 2007

Hi Ayush,

If I wanted to call a VBScript that runs some code, how would I do that? I'm
presuming the following code line would need to be changed somehow so that
rather than firing an inline message box, it would call a script sub in the
script tags:

<SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>

Thanks again!

"Ayush" <"ayushmaan.j[aatt]gmail.com" wrote:

> [XP]s message :
> > Hi Irfan,
> >
> > Here is the code; please help if you can and thanks:
> ....
>
> Try this:
>
> <HTML>
> <HEAD>
> <TITLE>Popup Custom Navigation Menu Sample</TITLE>
>
> <SCRIPT LANGUAGE="vbscript">
> Set oPopup = window.createPopup
> Function contextMenu
>
> lefter = window.event.offsetX+10
> topper = window.event.offsetY+10
> oPopup.document.body.innerHTML = oContextHTML.innerHTML
> oPopup.show lefter, topper, 200, 65, window.document.body
> window.event.returnValue=false
> End Function
>
> </SCRIPT>
>
> </HEAD>
> <BODY oncontextmenu="contextMenu">
> <h1>Creating Custom Context Menus with the Popup Object</h1>
> Right-click anywhere on the document to see a customized popup navigation
> menu.
>
> <DIV ID="oContextHTML" STYLE="display:none;">
> <DIV onmouseover=this.style.background="gold"
> onmouseout=this.style.background="#e4e4e4">
> <SPAN onclick=msgbox("xxx") language=vbscript>Menu Item One</SPAN>
> </DIV>
> <DIV onmouseover=this.style.background="gold"
> onmouseout=this.style.background="#e4e4e4">
> <SPAN onclick=msgbox("yyy") language="vbscript">Menu Item Two</SPAN>
> </DIV>
> </DIV>
>
> </BODY>
> </HTML>
>
> Good Luck, Ayush.
> --
> Windows XP: http://www.microsoft.com/windows/using/windowsxp/default.mspx
>