Popup Menu


© Maxim Karetnikov

The Popup Menu control is used to create a popup menu when the user clicks a link, named control or image link with the mouse on a Web page. This control is used mostly for navigational purposes. If you have a lot of links on a Web page that contains other important data, you can place those links in a popup.

The Popup Menu control can be taken from the Microsoft Web site by the following address:
http://activex.microsoft.com/controls/iexplorer/x86/iemenu.cab

The Popup Menu control has only one property, ItemCount. The ItemCount property is set to the number of items in the menu. The Menuitem[] parameter tag is used to label the individual items on the page. You can then use a script to call the URL of the page that you want to navigate to.

There are five methods associated with the Popup Menu control:

  • AboutBox: Brings up the About box for the control
  • Additem(item, index): Adds item at specified index
  • Clear: Clears all menu items
  • PopUp(x, y): Where x and y are position values
  • RemoveItem(index): Removes item at specified index

The example of using Popup Menu Control is given below.

<OBJECT ID="PopUp1" WIDTH=50 HEIGHT=50
CLASSID="CLSID:7823A620-9DD9-11CF-A662-00AA00C066D2"> <PARAM
NAME="MenuItem[0]" VALUE="VBScript"> <PARAM
NAME="MenuItem[1]" VALUE="JavaScript"> <PARAM
NAME="MenuItem[2]" VALUE="Perl"> </OBJECT>

The one event for the Popup Menu control is Click (item). The index of the item clicked is passed to the event.

Internet Explorer 5.5 supports this functionality natively with the createPopup() method of the window object. Using its functonality, you can  write the similar popup menu in the following way:

<body onClick="popOpen()">
<p><script language="VBScript"><!
Set Popup=window.createPopup()
set popupBody=Popup.document.body
popupBody.style.backgroundColor="blue"
Popup.document.body.style.color="yellow"
Popupbody.style.border="#000065 1px solid"
Popupbody.innerHTML="VBScript<br>JavaScript<br>Perl"
sub popOpen()
Popup.show window.parent.screen.width/2,window.parent.screen.height/2,100,70
end sub
</script> </p>

Go To Page: 1


The copyright of the article Popup Menu in VB Script is owned by . Permission to republish Popup Menu in print or online must be granted by the author in writing.

Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo